我在用梨(而且是新的)。插入时,时间戳比我的系统时间早两个小时(在本地主机中运行)。
在我的DB上写入LogEvent表时,我执行以下操作
$le = new LogEvent;
$le->userID = $_SESSION['userID'];
$le->event = $msg;
$le->priority = (int)$priority;
if ($le->priority > 0) {
$le->insert();
}在LogEvent类中,insert()如下所示
function insert() {
$this->timestamp = date('Y-m-d H:i:s');
$le = parent::insert();
return $le;
}DB准时运行在VM服务器上(系统+2 :例如06:00)
我的Windows本地主机运行在良好的系统时间( system +0 :例如04:00)
此插入在system 2中写入时间( SYSTEM -2 :例如02:00)
为什么这个date('Y-m-d H:i:s')给了我错误的时间。如果它以本地主机的形式或在本地主机运行,它不应该占用我的本地系统时间吗?
还是我忽略了一些很明显的东西?
发布于 2015-01-13 09:22:49
PHP时区-运行时
date_default_timezone_set('Europe/London');PHP时区- php.ini
date.timezone = "Europe/London"https://stackoverflow.com/questions/27918358
复制相似问题