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

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

问题描述

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

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

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

I added a varaible in my .env file:

APP_TIMEZONE=Europe/Paris

但这不起作用.什么是更新时区的正确方法?

But this doesnt work. What is the right way to update timezone?

推荐答案

您可以通过在 app.php 文件来设置应用时区 > 文件夹.

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

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

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 5)

list of timezones for PHP 5

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

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