How to set the time zone in the php configuration file: First find and open the configuration file "php.ini"; then search for the "date.timezone" item in the file and change the ";" in ";date.timezone=" "Remove, fill in the corresponding time zone identifier after "="; finally save the file and restart the server.
The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
php configuration file settings Time zone method
The PHP configuration file is the php.ini file in the PHP installation directory. Find and open it. Then search for date.timezone
in the file, we will see a piece of information as shown below:
[Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone ;date.timezone =
where;date.timezone =
the in front of it ;
has the same function as //
in PHP. They both mean comments. Here we need to remove this ;
and add =## in this sentence. #Fill in the corresponding time zone identifier later, as shown below:
[Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone = Asia/Shangha
Asia/Shanghai or
PRC" , remember to restart the server after successful setting!
<?php echo date('Y-m-d H:i:s',time()); ?>
2021-07-08 18:33:22
PHP Video Tutorial"
The above is the detailed content of How to set time zone in php configuration file. For more information, please follow other related articles on the PHP Chinese website!