Using PHP to get the system time, I found that the time was wrong because the default time zone of PHP is UTC, and its time zone should be set to Beijing time.
Method 1: Modify the php.ini file
Open the php.ini file: left-click the WampServer icon in the lower right corner - PHP - php.ini,
Find date.timezone, find date.timezone="UTC",
Change it to date.timezone = "PRC". If there is a semicolon on the left side of date.timezone, remove the semicolon.
<code><span><<span>span</span><span>class</span>=<span>"cur_time"</span>></span><span><span><?php</span><span>echo</span><span>"当前时间:"</span> . date(<span>"Y-m-d H:i:s"</span>) <span>?></span></span><span></<span>span</span>></span></code>
Method 2: Use date_default_timezone_set(”) method;
<code><span><?php</span> date_default_timezone_set(<span>'PRC'</span>); <span>echo</span> date(<span>"Y-m-d H:i:s"</span>); <span>?></span></code>
The above introduces what to do if the system time obtained by PHP date is wrong? It includes the content of PHP date. I hope it will be helpful to friends who are interested in PHP tutorials.