在 Lumen 或 Laravel 5 中更改时区 [英] Change Timezone in Lumen or Laravel 5

查看:49
本文介绍了在 Lumen 或 Laravel 5 中更改时区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Lumen 框架.如何将时区更改为欧洲/巴黎 CEST?

I am using Lumen framework. How can I change Timezone to Europe/Paris CEST?

我在 .env 文件中添加了一个变量:

I added a variable in my .env file:

APP_TIMEZONE=Europe/Paris

但这行不通.更新时区的正确方法是什么?

But this doesn't work. What is the right way to update the timezone?

推荐答案

您可以通过配置app.php来设置您的应用时区config 文件夹中的文件.

You can set your app time zone by configuring app.php file in config folder .

要更改时区,请修改 app.php 文件中 timezone 的值.

To change time zone , modify the value of timezone in app.php file.

这是写在这部分

|--------------------------------------------------------------------------
| 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.
|
 

对我来说,我使用亚洲/达卡作为我的申请时区.

For me i am using Asia/Dhaka as my application time zone.

这是适当的语法:

'timezone' => 'Asia/Dhaka'

PHP 的时区列表.

这篇关于在 Lumen 或 Laravel 5 中更改时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆