{"id":199240,"date":"2025-05-03T13:34:20","date_gmt":"2025-05-03T05:34:20","guid":{"rendered":"https:\/\/server.hk\/cnblog\/199240\/"},"modified":"2025-05-03T13:34:20","modified_gmt":"2025-05-03T05:34:20","slug":"%e5%ae%89%e8%a3%85ecshop%e6%8a%a5%e9%94%99date_default_timezone_set%e7%9a%84%e8%a7%a3%e5%86%b3%e6%b3%95","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/199240\/","title":{"rendered":"\u5b89\u88c5ecshop\u62a5\u9519date_default_timezone_set\u7684\u89e3\u51b3\u6cd5"},"content":{"rendered":"<p>&nbsp;\u5b89\u88c5ecshop\u51fa\u73b0\u8b66\u544a\uff1a&nbsp;<strong><font>Warning: date(): It is not safe to rely on the system&#8217;s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected &#8216;Asia\/Chongqing&#8217; for &#8216;CST\/8.0\/no DST&#8217; instead in \/data\/wwwroot\/includes\/lib_time.php on line 28 OK<\/font><\/strong><\/p>\n<p> <span style=\"font-family: Tahoma, Helvetica, SimSun, sans-serif;font-size: 14px;line-height: 21px\">\u5982\u56fe\u6240\u793a<\/span><br \/>  <img decoding=\"async\" class=\"aligncenter\" style=\"cursor: pointer\" src=\"https:\/\/www.ldhost.cn\/helphmb\/php\/ecshop\/data\/attachment\/forum\/201203\/08\/0039053s5tsy9kz3z3k2ec.jpg\">&nbsp; <br \/> <font> <\/font><\/p>\n<p><font><span style=\"font-size: 14px;line-height: 21px\">\u6211\u4eec\u53ef\u4ee5\u6253\u5f00init.php\u627e\u5230<\/span><\/font>  <\/p>\n<p><font> <\/font><\/p>\n<p><font><span style=\"font-size: 14px;line-height: 21px\"><br \/> <\/span><\/font>  <\/p>\n<p><font> <\/font><\/p>\n<p><font><span style=\"font-size: 14px;line-height: 21px\">if (PHP_VERSION &gt;= &#8216;5.1&#8217; &amp;&amp; !empty($timezone))<\/span><\/font><br \/>\n<font>  <span style=\"font-size: 14px;line-height: 21px\">{<\/span>   <span style=\"font-size: 14px;line-height: 21px\">date_default_timezone_set($timezone);<\/span>   <span style=\"font-size: 14px;line-height: 21px\">}<\/span>   <span style=\"font-size: 14px;line-height: 21px\"><br \/> <\/span> <span style=\"font-size: 14px;line-height: 21px\"><br \/> <\/span>   <span style=\"font-size: 14px;line-height: 21px\">\u6539\u6210<\/span>   <span style=\"font-size: 14px;line-height: 21px\"><br \/> <\/span>   <span style=\"font-size: 14px;line-height: 21px\">if (PHP_VERSION &gt;= &#8216;5.1&#8217;)<\/span>   <span style=\"font-size: 14px;line-height: 21px\">{<\/span>   <span style=\"font-size: 14px;line-height: 21px\">empty($timezone) date_default_timezone_set(&#8220;PRC&#8221;):date_default_timezone_set($timezone);<\/span>   <span style=\"font-size: 14px;line-height: 21px\">}<\/span>   <span style=\"font-size: 14px;line-height: 21px\"><br \/> <\/span>   <span style=\"font-size: 14px;line-height: 21px\"><br \/> <\/span> <span style=\"font-size: 14px;line-height: 21px\"><br \/> <\/span> <span style=\"font-size: 14px;line-height: 21px\">\u5c31\u53ef\u4ee5\u4e86,\u5982\u679c\u8fd9\u6837\u8fd8\u662f\u4e0d\u884c\uff0c\u5c31\u53ea\u6709\u6539php.ini,\u7136\u540e\u91cd\u542f\u670d\u52a1\u5668<\/span>   <span style=\"font-size: 14px;line-height: 21px\"><br \/> <\/span>   <span style=\"font-size: 14px;line-height: 21px\">\u5728php.ini\u4e2d\u8bbe\u7f6e<\/span>   <span style=\"font-size: 14px;line-height: 21px\"><br \/> <\/span>   <span style=\"font-size: 14px;line-height: 21px\">date.timezone=PRC<\/span>   &nbsp;   \u597d\u6a21\u677f\u6559\u7a0b\u5b8c\u6bd5\uff0c\u8fd9\u4e2a\u662f\u65f6\u533a\u95ee\u9898  <\/font><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;\u5b89\u88c5ecshop\u51fa\u73b0&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4925],"tags":[],"class_list":["post-199240","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199240","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=199240"}],"version-history":[{"count":0,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/199240\/revisions"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=199240"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=199240"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=199240"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}