public function LogWirte($Astring)
{
$path = $_SERVER['DOCUMENT_ROOT'];
$path = $path."/runtime/log/";
$file = $path."log".date('Ymd',time()).".txt";
if(!is_dir($path)){ mkdir($path); }
$LogTime = date('Y-m-d H:i:s',time());
if(!file_exists($file))
{
$logfile = fopen($file, "w") or die("Unable to open file!");
fwrite($logfile, "[$LogTime]:".$Astring."\r\n");
fclose($logfile);
}else{
$logfile = fopen($file, "a") or die("Unable to open file!");
fwrite($logfile, "[$LogTime]:".$Astring."\r\n");
fclose($logfile);
}
}
tp写入runtime文件,可用于异步回调信息保存
最新推荐文章于 2024-05-02 21:57:09 发布