简体   繁体   English

Symfonys date_default_timezone_get()

[英]Symfonys date_default_timezone_get()

So I installed composer and apache and mysql, and then installed symfony, but after the installation it tells me to change the date because it is not reliable and then I can use it freely. 因此,我安装了composer以及apache和mysql,然后安装了symfony,但是安装后它告诉我更改日期,因为它不可靠,然后我可以自由使用它。

I have changed the date in php.ini with Europe/Bucharest but is still get this message: 我已经使用Europe / Bucharest更改了php.ini中的日期,但仍然收到此消息:

[Symfony\Component\Debug\Exception\ContextErrorException]                    
Warning: date_default_timezone_get(): It is not safe to rely on the system'  
s timezone settings. You are *required* to use the date.timezone setting or  
the date_default_timezone_set() function. In case you used any of those me  
thods and you are still getting this warning, you most likely misspelled th  
e timezone identifier. We selected the timezone 'UTC' for now, but please s  
et date.timezone to select your timezone. 

I use fedora 23 32-bit.I have looked over other solutions but none of them work. 我使用的是32位的fedora 23,我查看了其他解决方案,但没有一个起作用。

In Symfony2 just add this at the end of your class app/AppKernel.php : 在Symfony2中,只需将其添加到类app / AppKernel.php的末尾:

public function init() {
    date_default_timezone_set( 'Europe/Bucharest' );
    parent::init();
}

In Symfony3, use : 在Symfony3中,使用:

public function __construct($environment, $debug) {
    date_default_timezone_set('Europe/Bucharest');
    parent::__construct($environment, $debug);
}
public function __construct($environment, $debug)
{
    parent::__construct($environment, $debug);
    date_default_timezone_set('Asia/Shanghai');
}

I use this in symphony 2.3 我在交响乐2.3中使用此

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 @date_default_timezone_get()默默崩溃 - @date_default_timezone_get() silently crashes 警告:date_default_timezone_get()安装Symfony - Warning: date_default_timezone_get() installing Symfony PHP-date_default_timezone_get()-错误的结果 - php - date_default_timezone_get() - wrong result date_default_timezone_get 有时加载缓慢 - date_default_timezone_get is sometimes slow to load Appfnel中的Symfony2和date_default_timezone_get()不变 - Symfony2 and date_default_timezone_get() in appkernel doesnot change date_default_timezone_get()返回的值与php.ini中设置的默认时区不同 - date_default_timezone_get() returns different value than the default timezone set in php.ini 默认欧洲时区在php.ini中设置,但date_default_timezone_get()返回'UTC' - Default Europe timezone set in php.ini, but date_default_timezone_get() returns 'UTC' Symfony2和date_default_timezone_get() - 依赖系统的时区设置是不安全的 - Symfony2 and date_default_timezone_get() - It is not safe to rely on the system's timezone settings date_default_timezone_get():依赖系统的时区设置是不安全的 - date_default_timezone_get(): It is not safe to rely on the system's timezone settings PHP,服务器发送事件 - date_default_timezone_get()在远程文件中无法正常工作 - PHP, Server-Sent Events - date_default_timezone_get() does not work properly in remote file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM