**
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 getting this warning, you most likely misspelled the timezone identifier. We selected the timezone ‘UTC’ for now, but please set date.timezone to select your timezone. in file /www/wwwroot/yyktt.net/Workerman/Worker.php on line 2082 Workerman[start.php] is stopping …
**
提示错误:说是时间不安全,选择了utc的时区,需要设置一下timezone
我试过两种方法
第一种:在执行date()方法前设置时区,代码实现 ini_set(‘date.timezone’,‘Asia/Shanghai’);

第二种:设置php-ini文件 这种方式推荐使用
找到php.ini文件打开它,看看里面有没有date.timezone把前面的;去掉

再添加一行date_default_timezone_set(‘UTC’);
重启服务器,完成;
本文详细介绍了如何解决在PHP中遇到的时间设置警告问题,包括在代码中直接设置时区和修改php.ini配置文件两种方法,并提供了具体的代码示例。
482

被折叠的 条评论
为什么被折叠?



