首页 > 代码库 > mac上运行php文件中的date()报错问题

mac上运行php文件中的date()报错问题

学习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 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 /Users/libolin/Sites/www/mes/php/mes.php on line 7

It is not safe to rely on the system‘s timezone settings

大概是说时区不对,然后试着在文本头部添加 :   ini_set(‘date.timezone‘,‘Asia/Shanghai‘);  //问题得到解决

这个地址参考: http://www.phperz.com/article/14/1220/5793.html

mac上运行php文件中的date()报错问题