Home > Backend Development > PHP Tutorial > 【php】Error related to time function date()!

【php】Error related to time function date()!

不言
Release: 2023-03-22 19:44:02
Original
1572 people have browsed it

This article shares with you the solutions to errors related to the PHP time function data(). Friends in need can refer to it

Today I am changing a method to filter data by time When connecting the interface, an error suddenly appeared inexplicably. I took a quick look and it was an error in the date() function. I was using the environment of PHP5.6+nginx1.10, and the error message As follows:

date(): it is not safe to rely on the system's timezone settings.
Copy after login

【php】Error related to time function date()!

Baidu, it is said on the Internet that this kind of error will be reported when it comes to time after PHP5.3, the best solution The solution is to modify the php.ini file. The modification method is as follows:

  1. Open php.ini and find date.timezone

Under Linux and Mac systems, the location of the php.ini file is generally in the /usr/local/etc/php directory. If you cannot find it, you can use the whereis php.ini command to find it. The window is usually in PHP. Under the installation directory

  1. Modify date.timezone

Use the vim php.ini command to open the file and find date.timezone

【php】Error related to time function date()!

Remove the ; number in front and change it to date.timezone ="PRC", save and restart and it will be OK!


The above is the detailed content of 【php】Error related to time function date()!. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template