What to do if the Date acquisition time in PHP is incorrect_PHP Tutorial

WBOY
Release: 2016-07-21 15:52:20
Original
897 people have browsed it

Today, when I used echo $showtime=date("Y-m-d H:i:s") to obtain the system time, I found that the obtained time did not match the system time.

After some research, we found that the default time set by PHP is based on Greenwich Time Zone, so we must change PHP's time zone setting to Beijing time.

Operation method:

Open the php.ini file, usually in the PHP installation root directory
Find the;date.timezone
Delete the points in front of date.timezone number, and change it to date.timezone = PRC
Save and restart the Apahce service (sometimes there will be problems with Apache's restart function, it is recommended to stop first and then start)
Let's recheck echo $showtime= date("Y-m-d H:i:s").

Has time returned to normal?

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/318947.htmlTechArticleWhen I used echo$showtime=date("Y-m-dH:i:s") to get the system time today, I found that The time obtained does not match the system time. After some research, I found that the default time set by PHP is based on Greenwich Time...
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