简体   繁体   English

Appfnel中的Symfony2和date_default_timezone_get()不变

[英]Symfony2 and date_default_timezone_get() in appkernel doesnot change

I am getting this error 我收到此错误

I tried to change write this function in app/appkernel.php 我试图更改在app / appkernel.php中写入此功能

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

i have also tried with __construct method but it still doesnot work. 我也尝试了__construct方法,但仍然无法正常工作。

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

But i still get this error... I cannt make changes to php.ini file as I am on virtual host and they dont allow 但是我仍然遇到此错误...我无法更改php.ini文件,因为我在虚拟主机上,并且它们不允许

Error screen shot 错误屏幕截图

将其添加到symfony2根目录的index.php文件中:

 date_default_timezone_set('Europe/London');

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM