YII框架中,可以直接在/protected/config/main.php中設(shè)置時區(qū),即可(補充:Yii2方法也是一樣,在common/config/main.php中添加)。? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??(推薦學習:yii教程)
在config文件夾下,main.php 中,
return?[ ????'charset'?=>?'utf-8', ????'language'?=>?'zh-CN', ????'timeZone'?=>?'Asia/Shanghai', ????'components'?=>?[ ????????'cache'?=>?[ ????????????'class'?=>?'yiicachingFileCache' ????????], ????????'formatter'?=>?[ ????????????'dateFormat'?=>?'yyyy-MM-dd', ????????????'timeFormat'?=>?'HH:mm:ss', ????????????'datetimeFormat'?=>?'yyyy-MM-dd?HH:mm:ss' ????????] ????] ];
? 版權(quán)聲明
文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載。
THE END