如何在php中修复时区

时间:2022-10-16 09:41:53

Im using PHP and Json to get data for login and register user in Android, When I request to server by Json, I received the result following as:

我使用PHP和Json获取登录数据并在Android中注册用户,当我通过Json向服务器请求时,我收到以下结果:

<b>Warning</b>:  date(): 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 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 <b>C:\AppServ\www\DemoApp\DBOperations.php</b> on line <b>114</b><br />
{"result":"success","message":"Check your mail for reset password code."}

How to fix timezone in PHP?

如何在PHP中修复时区?

1 个解决方案

#1


1  

Did you read the notice you got there? It's pretty explanatory:

你读过那里的通知了吗?这很有说服力:

You are required to use the date.timezone setting or the date_default_timezone_set() function.

您需要使用date.timezone设置或date_default_timezone_set()函数。

If you don't want to set the timezone in your php.ini file, you can use the date_default_timezone_set function:

如果您不想在php.ini文件中设置时区,可以使用date_default_timezone_set函数:

date_default_timezone_set('America/Los_Angeles');

For example.

#1


1  

Did you read the notice you got there? It's pretty explanatory:

你读过那里的通知了吗?这很有说服力:

You are required to use the date.timezone setting or the date_default_timezone_set() function.

您需要使用date.timezone设置或date_default_timezone_set()函数。

If you don't want to set the timezone in your php.ini file, you can use the date_default_timezone_set function:

如果您不想在php.ini文件中设置时区,可以使用date_default_timezone_set函数:

date_default_timezone_set('America/Los_Angeles');

For example.