Laravel 日期默认错误
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29298766/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
laravel date default error
提问by Ravindra Barthwal
When I always install laravel v5 and after completing it's install when i view to the new installation the errors come out
当我总是安装 laravel v5 并在完成安装后,当我查看新安装时出现错误
Warning: date_default_timezone_set(): It is not safe to rely on the system's timezone settings. You are requiredto use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in D:\vendor\compiled.php on line 1808
Notice: date_default_timezone_set(): Timezone ID '' is invalid in D:\vendor\compiled.php on line 1808
Warning: Illuminate\Foundation\Bootstrap\ConfigureLogging::configureHandlers(): It is not safe to rely on the system's timezone settings. You are requiredto use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in D:\vendor\compiled.php on line 1673
Fatal error: Call to undefined method Illuminate\Foundation\Bootstrap\ConfigureLogging::configureHandler() in D:\vendor\compiled.php on line 1673
警告:date_default_timezone_set():依赖系统的时区设置是不安全的。您需要使用 date.timezone 设置或 date_default_timezone_set() 函数。如果您使用了这些方法中的任何一种并且仍然收到此警告,则很可能是时区标识符拼错了。我们现在选择了时区“UTC”,但请设置 date.timezone 以选择您的时区。在 D:\vendor\compiled.php 第 1808 行
注意:date_default_timezone_set(): Timezone ID '' is invalid in D:\vendor\compiled.php on line 1808
警告:Illuminate\Foundation\Bootstrap\ConfigureLogging::configureHandlers():依赖系统的时区设置是不安全的。您 需要使用 date.timezone 设置或 date_default_timezone_set() 函数。如果您使用了这些方法中的任何一种并且仍然收到此警告,则很可能是时区标识符拼错了。我们现在选择了时区“UTC”,但请设置 date.timezone 以选择您的时区。在 D:\vendor\compiled.php 第 1673 行
致命错误:调用未定义的方法 Illuminate\Foundation\Bootstrap\ConfigureLogging::configureHandler() in D:\vendor\compiled.php on line 1673
But everything fine for v4.2.0 and it working i want to use v5 so please tell me.
Thanks In advance
但是对于 v4.2.0 一切正常,并且可以正常工作,我想使用 v5,所以请告诉我。
提前致谢
采纳答案by Abdulla Nilam
We can set timezone in configfile app/config/app.php
or any app/config/environment/app.php
at below section.
我们可以在配置文件app/config/app.php
或app/config/environment/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.
|
*/
// Default value of timezone is 'UTC', I have changed it to 'Asia/Kolkata'
'timezone' => 'Asia/Kolkata',