国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 高要市| 凌源市| 成安县| 乐业县| 本溪市| 东海县| 平江县| 新绛县| 肥东县| 香格里拉县| 利川市| 镇宁| 仪征市| 定南县| 赣州市| 措勤县| 五华县| 淮阳县| 石狮市| 太仆寺旗| 营山县| 江达县| 莒南县| 山西省| 商河县| 东山县| 亳州市| 西充县| 资中县| 棋牌| 三门峡市| 特克斯县| 乌拉特后旗| 万盛区| 海原县| 肃北| 巫山县| 天全县| 武山县| 平江县| 盐池县|