note 93074 deleted from function.print-r by danbrown
| From: | danbrown@php.net | Date: | Fri, 21 Aug 2009 19:23:04 +0000 |
| Subject: | note 93074 deleted from function.print-r by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-159766@lists.php.net to get a copy of this message | ||
Note Submitter: rdibona at yahoo dot com
----
In response to sebasg37 at gmail dot com, the second parameter can be set to true to catch the
print_r output in a variable. Then you can simply write that variable to your log file. If your log
can get large, there is no need to read the entire log in just to append. So here is some modified
code:
<?php
$outstr = print_r($_REQUEST, true);
$handle = fopen("requestlog.txt", "ab");
fwrite($handle, date('r') . "-- " . $outstr . "\n\n");
fclose($handle);
?>