php简单日志写入函数

 1 function showLog($content,$filename="filenamelog")
 2 {
 3     $logfile = 'logs/'.$filename.date('Ymd').'.txt';
 4     if(!file_exists(dirname($logfile)))
 5     {
 6         mkdir(dirname($logfile));
 7     }
 8     error_log(date("[Y-m-d H:i:s]")."-[".$_SERVER["REMOTE_ADDR"]."]\t[".$_SERVER['REQUEST_URI']."]:".$content."\n", 3,$logfile);
 9 }
10 showLog("");

www.5929.com,php简单日志写入函数。php简单日志写入函数。 

Leave a Comment.