更改了时区但仍然获得了UTC

时间:2015-03-31 23:31:24

标签: laravel

我已将laravel应用的时区更改为Africa\Cairo,我在app.php文件中更改了此内容

|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/

'timezone'        => 'Africa/Cairo',

但是当我使用Carbon::now()检查生产时区时,我得到的时区是UTC

如何在Carbon中设置时区

3 个答案:

答案 0 :(得分:1)

确保清除缓存,然后将其写入终端(在项目目录中):

php artisan config:cache

然后再次启动项目以查看更改

答案 1 :(得分:0)

只需使用Carbon::now('Africa/Cairo')即可。 这应该会给你正确的时间。

希望这有帮助。

答案 2 :(得分:0)

尝试这个

from pytext.config import pytext_config_from_json
相关问题