How to set the system time in php: first find and open the "php.ini" file; then find the ";date.timezone=" option under "date"; then modify this item to "date.timezone" =Asia/hong_kong”; Finally, restart the server.
Recommended: "PHP Video Tutorial"
How to set the current time of the PHP system
Since PHP5.0 has rewritten the date() function, the current date and time function is 8 hours less than the system time.
In the PHP language, the default setting is It is standard Greenwich Time (that is, the zero time zone is used), so to obtain the current local time, you must change the time zone setting in the PHP language. The method is as follows.
In the php.ini file, find [ ";date.timezone=" option under date], change this item to "date.timezone=Asia/hong_kong", and then restart the Apache server.
After the setting is completed, the current time of the output system will be There will be no jet lag problem.
The above is the detailed content of How to set system time in php. For more information, please follow other related articles on the PHP Chinese website!