diff --git a/Config.example.php b/Config.example.php index a9edb71..1432da0 100644 --- a/Config.example.php +++ b/Config.example.php @@ -2,6 +2,8 @@ return [ // 网站名 'site_name' => 'XXX 的博客', + // 时区 + 'TimeZone' => 'Asia/Shanghai', // 支持跨域访问的域名 'allow_origin' => [ 'http://localhost:8080' // 或 '*' 跨域无限制 diff --git a/app/components/Action.php b/app/components/Action.php index 8af4e7c..d3b6a0b 100644 --- a/app/components/Action.php +++ b/app/components/Action.php @@ -77,6 +77,7 @@ public function actionCommentAdd() $comment->page_key = $pageKey; $comment->rid = $rid; $comment->ua = $ua; + $TimeZone = date_default_timezone_set(_config()['TimeZone']); $comment->date = date("Y-m-d H:i:s"); $comment->ip = $this->getUserIP(); $comment->is_collapsed = false;