Change Timezone in Lumen or Laravel 5(在 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 中更改时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在 Lumen 或 Laravel 5 中更改时区
基础教程推荐
- 如何在 Laravel 中使用 React Router? 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 如何替换eregi() 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
