更改为php.ini没有效果(Change to php.ini does not have effect)

我在php.ini文件中添加了这一行:date.timezone =“Europe / Rome”。

但是phoinfo()仍然告诉我这个:date.timezone America / Phoenix America / Phoenix。

我错在哪里?

I added this line to my php.ini file: date.timezone = "Europe/Rome".

But phoinfo() still show me this: date.timezone America/Phoenix America/Phoenix.

Where I'm wrong?

最满意答案

如果您没有权限重新启动服务器,则还可以从脚本中设置时区:

<?php date_default_timezone_set('America/Phoenix'); //rest of your code. ?>

这里是PHP支持的时区列表。

You can also set time zone from your script in case you don't have permission to restart the server:

<?php date_default_timezone_set('America/Phoenix'); //rest of your code. ?>

And here the list of supported time zones by PHP.

更多推荐