可以在配置文件中设置时区为"Asia/Shanghai",例如:

return [
    // ...
    'components' => [
        // ...
        'formatter' => [
            'dateFormat' => 'php:Y-m-d',
            'timeFormat' => 'php:H:i:s',
            'datetimeFormat' => 'php:Y-m-d H:i:s',
            'timeZone' => 'Asia/Shanghai', // 设置时区为上海
        ],
        // ...
    ],
    // ...
];

这样,在调试信息中输出的时间将会以中文时区的时间格式显示。

yii2 如何设置debug的时间054139923为中文时区

原文地址: https://www.cveoy.top/t/topic/c9kQ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录