国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > PHP > 正文

PHP date()函數(shù)It is not safe to rely on the system s timezone settings

2024-09-04 11:49:32
字體:
供稿:網(wǎng)友

在寫php文件上傳程序時(shí)有時(shí)會(huì)出現(xiàn)這樣的警告:

  1. Type: image/png   
  2. Size: 66.84765625 Kb   
  3. Temp file: D:/Users/Aven/AppData/Local/Temp/php742F.tmp   
  4.    
  5. Warning: move_uploaded_file() [function.move-uploaded-file]: 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 'UTC' for '8.0/no DST' instead in F:/PHP/upload_file.php on line 26   
  6.    
  7. Warning: move_uploaded_file(upload/屏幕截圖2014-09-28_160214.png) [function.move-uploaded-file]: failed to open stream: No such file or directory in F:/PHP/upload_file.php on line 26   
  8.    
  9. Warning: move_uploaded_file() [function.move-uploaded-file]: 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 'UTC' for '8.0/no DST' instead in F:/PHP/upload_file.php on line 26   
  10.    
  11. Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'D:/Users/Aven/AppData/Local/Temp/php742F.tmp' to 'upload/屏幕截圖2014-09-28_160214.png' in F:/PHP/upload_file.php on line 26   
  12. Stored in: upload/屏幕截圖2014-09-28_160214.png  

這是因?yàn)镻HP所取的時(shí)間是格林威治標(biāo)準(zhǔn)時(shí)間,所以和你當(dāng)?shù)氐臅r(shí)間會(huì)有出入格林威治標(biāo)準(zhǔn)時(shí)間和北京時(shí)間大概差8個(gè)小時(shí)左右,我們可以按照下面的方法解決:

1、在頁頭使用date_default_timezone_set()設(shè)置我的默認(rèn)時(shí)區(qū)為北京時(shí)間,即 <?php date_default_timezone_set("PRC"); ?>就可以了。

2、在php.ini中設(shè)置date.timezone的值為PRC,設(shè)置好以后的為:date.timezone=PRC,同時(shí)取消這一行代碼的注釋,即去掉前面的分號(hào)就可以了。

這里選用修改配置文件的方式解決問題:

用Notepad++打開php.ini,查找“date.timezone”,把語句前的分號(hào)去掉,值設(shè)置為“PRC”,重啟FastCGI服務(wù),問題解決。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 新蔡县| 洛浦县| 泽普县| 岐山县| 秀山| 永清县| 施秉县| 黑山县| 安阳市| 卢湾区| 屏东市| 河西区| 澎湖县| 封丘县| 高陵县| 大悟县| 开原市| 岫岩| 宜昌市| 阿鲁科尔沁旗| 边坝县| 新干县| 龙江县| 大新县| 天镇县| 五常市| 乐安县| 田林县| 当雄县| 荥经县| 望谟县| 平塘县| 双城市| 巴塘县| 准格尔旗| 北海市| 比如县| 贵定县| 韶关市| 桐柏县| 南安市|