所以这是我到目前为止的代码:
// Send error message to the server log if error connecting to the database
date_default_timezone_set("Europe/London");
error_log("Incorrect login details have been entered by a user".PHP_EOL, 3, "logs/ErrorLogs.txt");
,它将其发送到这样的错误日志:错误日志输出文件
在消息"不正确登录..."之前,我希望它显示错误的日期和时间。
预先感谢您
您可以使用date()函数:
date_default_timezone_set("Europe/London");
$errordate = date(DATE_RFC2822);
error_log("On " .$errordate ." : Incorrect login details have been entered by a user ".PHP_EOL, 3, "logs/ErrorLogs.txt");
将日期/时间添加到字符串
error_log(date('Y-d-m H:i:s') . ": Incorrect login details have been entered by a user" . PHP_EOL, 3, "temp.txt");