php简单日志写入函数
2021-02-03 23:13
标签:lan php err 简单 remote sts dir cti date php简单日志写入函数 标签:lan php err 简单 remote sts dir cti date 原文地址:https://www.cnblogs.com/KillBugMe/p/13151747.htmlfunction showLog($content,$filename="filenamelog")
{
$logfile = ‘logs/‘.$filename.date(‘Ymd‘).‘.txt‘;
if(!file_exists(dirname($logfile)))
{
mkdir(dirname($logfile));
}
error_log(date("[Y-m-d H:i:s]")."-[".$_SERVER["REMOTE_ADDR"]."]\t[".$_SERVER[‘REQUEST_URI‘]."]:".$content."\n", 3,$logfile);
}
showLog("");