欢迎来到 54818模板网!这是一个yzmcms的模板分享站。

write_error_log

相关案例演示

/**(V6.3 新增)(V6.8 更新)
 * 记录错误日志
 * @param $err_arr 错误信息
 * @param $path 日志路径
 * @return bool
 */
function write_error_log($err_arr, $path = '') {
	if(!C('error_log_save') || defined('CLOSE_WRITE_LOG')) return false;
	$err_arr = is_array($err_arr) ? $err_arr : array($err_arr);
	$message[] = date('Y-m-d H:i:s');
	$message[] = get_url();
	$message[] = getip();
	if(isset($_POST) && !empty($_POST)) $message[] = new_json_encode($_POST, JSON_UNESCAPED_UNICODE);
	$message = array_merge($message, $err_arr);
	$message = join(' | ', $message)."\r\n";
	if(!$path) $path = YZMPHP_PATH.'cache';
	if(!is_dir($path)) @mkdir($path, 0777, true);
	$file = $path.DIRECTORY_SEPARATOR.'error_log.php';
	if(is_file($file) && filesize($file)>20971520){
		@rename($file, $path.DIRECTORY_SEPARATOR.'error_log'.date('YmdHis').rand(100,999).'.php') ;
	}
	if(!is_file($file)){
		error_log("<?php exit;?>\r\n", 3, $file);
	}
	return error_log($message, 3, $file);
}

    上一篇:config

    下一篇:new_json_encode

    作者:54818模板网 关注:451 时间:2023-04-04 15:07:45
    相关网站教程