日志

public static function LogWirte($Astring)//日志方法
{
$path=APP_PATH . 'Lib/Payment/logs/';
$file = $path."Log".date('Y-m-d',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);
}
//$path=APP_PATH . 'Lib/Payment/logs/logs.txt';简单日志
//file_put_contents($path, $params);
}

posted @ 2017-03-09 15:11  哼哼哈兮啊  阅读(86)  评论(0编辑  收藏  举报