Re: print_r output to a file
| From: | Jason Wong | Date: | Thu, 07 Nov 2002 11:04:38 +0000 |
| Subject: | Re: print_r output to a file | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-123135@lists.php.net to get a copy of this message | ||
On Thursday 07 November 2002 18:12, Kerry Kobashi wrote:
> Is there a way to send print_r output to a file?
Try something like this:
ob_start();
if ($title) {
$title = '[' . date('Y-m-d H:i:s') . "]
{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}::$title";
echo "$title\n";
}
if ($message) {
print_r($message);
echo "\n";
}
$tmp = ob_get_contents();
ob_end_clean();
error_log($tmp, 3, "/some/path/or/another/php.log");
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
He thinks by infection, catching an opinion like a cold.
*/