In the PHP version above PHP5.3, as long as the time is involved will report a
"PHP warning:date () [function.date]: It is isn't safe to rely on the system ' timezone settings.
You are are *required* to use the Date.timezone setting or the Date_default_timezone_set () function.
In case you are used any of those methods and your are still getting this warning, for you most likely
Misspelled the timezone identifier. We selected ' UTC ' for ' 8.0/no DST ' instead in '
Such a mistake. How to solve it?
In fact, from PHP 5.1.0, when you use a function such as date (), if the timezone is set incorrectly, every time function is called, it will
Generate E_notice or e_warning information. And again in php5.1.0, date.timezone this option, which is off by default, without
What PHP command is used is Greenwich Mean time, but PHP5.3 seems to be forced to throw the error if there is no setting, to resolve the question
Problem, as long as the localization, on the line.
Here are three methods (any of which can be selected):
First, in the page using Date_default_timezone_set () Set Date_default_timezone_set (' PRC '); East Eight time zone echo
Date (' y-m-d h:i:s ');
Second, the use of Ini_set (' Date.timezone ', ' Asia/shanghai ') in the head of the page;
Third, modify the php.ini. Open Php5.ini Find Date.timezone Remove the preceding semicolon modify to become: Date.timezone =PRC
Restart the HTTP service (such as Apache2 or IIS, etc.).
XXX can be any correct value. For our domestic: can be the following values: Asia/chongqing, Asia/shanghai, Asia/urumqi
(in turn, Chongqing, Shanghai, Urumqi) Taiwan available: Asia/macao, Asia/hong_kong, Asia/taipei (Macao in turn)
, Hong Kong, Taipei, and Singapore: Asia/singapore, of course, PRC is OK.
Summary, the original before the php5.3 version of the date is not strictly limited so it is my date set is not correct and no problem, but after php5.3.