note 93074 added to function.print-r
| From: | rdibona at yahoo dot com | Date: | Fri, 21 Aug 2009 19:16:32 +0000 |
| Subject: | note 93074 added to function.print-r | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159763@lists.php.net to get a copy of this message | ||
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);
?>
----
Server IP: 69.147.83.197
Probable Submitter: 72.227.120.241
----
Manual Page -- http://www.php.net/manual/en/function.print-r.php
Edit -- https://master.php.net/note/edit/93074
Del: integrated -- https://master.php.net/note/delete/93074/integrated
Del: useless -- https://master.php.net/note/delete/93074/useless
Del: bad code -- https://master.php.net/note/delete/93074/bad+code
Del: spam -- https://master.php.net/note/delete/93074/spam
Del: non-english -- https://master.php.net/note/delete/93074/non-english
Del: in docs -- https://master.php.net/note/delete/93074/in+docs
Del: other reasons-- https://master.php.net/note/delete/93074
Reject -- https://master.php.net/note/reject/93074
Search -- https://master.php.net/manage/user-notes.php