Home >Backend Development >PHP Tutorial >Detailed explanation of the correct method to modify PHP time zone_PHP tutorial

Detailed explanation of the correct method to modify PHP time zone_PHP tutorial

WBOY
WBOYOriginal
2016-07-15 13:33:55847browse

1. Modify the PHP.ini file

Find the date.timezone line and remove the preceding semicolon , change to:

date.timezone = Asia/Shanghai

2. Modify the .htaccess file

There are two ways to modify the .htaccess file, As long as one of the following two statements is required

php_value date.timezone Asia/Shanghai
SetEnv TZ Asia/Shanghai

3. Modify the PHP code

Only one of the following two statements is enough

date_default_timezone_set('Asia/Shanghai');
ini_set('date.timezone','Asia/Shanghai');

For example:

<ol class="dp-xml"><li class="alt"><span><span class="tag"><</span><span> ?php   </span></span></li><li><span>date_default_timezone<br />_set('Asia/Shanghai');   </span></li><li class="alt"><span class="tag">?></span><span> </span></span></li></ol>


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446039.htmlTechArticle1. Modify the PHP.ini file and find the date.timezone line. Remove the semicolon in front and change it to: date.timezone = Asia/Shanghai 2. Modify the .htaccess file. There are two ways to modify the .htaccess file...
Statement:
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