The correct method for modifying the PHP time zone is described in detail. 1. modify the PHP. ini file to find the date. timezone line. remove the semicolon and change it to date. timezoneAsiaShanghai2. modify the. htaccess file to modify the. htaccess file.
1. modify the PHP. ini file.
Find the date. timezone line, remove the semicolon, and change it:
Date. timezone = Asia/Shanghai
2. modify the. htaccess file
There are two ways to modify the. htaccess file: the following two statements only need one.
Php_value date. timezone Asia/Shanghai
SetEnv TZ Asia/Shanghai
3. modify PHP code
Only one of the following two statements can be used.
Date_default_timezone_set ('Asia/Shanghai ');
Ini_set ('date. timezone ', 'Asia/Shanghai ');
For example:
- < ?php
- date_default_timezone
_set('Asia/Shanghai');
- ?>
Locate date. timezone, remove the semicolon, and change it to date. timezone = Asia/Shanghai 2. modify the. htaccess file to modify the. htaccess file. There are two ways to do this...