Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The date () function in PHP warns: what about It is not safe to rely on the system

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you the date () function warning in PHP: what to do with It is not safe to rely on the system? I hope you will get something after reading this article. Let's discuss it together.

Recently, there is always a systematic email prompt. I didn't pay attention to it at first, but then I took a look at it again and again. Prompt for the following information

PHP Warning: date (): It is not safe to rely on the system'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 gett

Ing this warning, you most likely misspelled the timezone identifier. We selected 'Asia/Chongqing' for' CST/8.0/no DST' instead in / data0/htdocs/www.qttc.net/function/function.php on line 542

Generally speaking, timezone is not set up, but Green + 8 hours is used in China, so it needs to be set up.

First kind

Add the following statement to the header of the page

Date_default_timezone_set ("PRC")

The drawback of this approach is that all pages have to be added.

The second kind

Find the line date.timezone in php.ini and change the value to PRC, such as date.timezone = PRC. If you don't have this line, just add it. Finally, restart the WEB server and PHP.

After reading this article, I believe you have a certain understanding of "date () function warning in PHP: what to do with It is not safe to rely on the system". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report