php写日志函数
1.函数
function log($data){
$log_file = 'F:\work\mph\oto.mph88.com\log\a'.date('Ymd',time()).'_all.log';
$content =var_export($data,TRUE);
$content .= "\r\n\n";
file_put_contents($log_file,$content, FILE_APPEND);
}
2.书写格式
$log_file = CONF_PATH.'logs/Logs/' . date('Ymd', time()) . '_wx_message.log';
//当前链接
$url = $_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF'];
//写入的内容
$content = "[url:] {$url}\r\n[time:]".date('Y-m-d H:i:s',time())."\r\n\n[openid:]asd";
//写入到log文本中
file_put_contents($log_file,$content, FILE_APPEND);
3.效果图:时间+键+值