国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 措勤县| 楚雄市| 安康市| 彰化县| 黄山市| 洪湖市| 和龙市| 巴塘县| 青铜峡市| 文安县| 德兴市| 永春县| 盐津县| 波密县| 镇安县| 新余市| 镇沅| 屯昌县| 靖宇县| 定州市| 安远县| 云阳县| 清苑县| 静乐县| 德庆县| 西吉县| 新营市| 囊谦县| 长海县| 菏泽市| 弥勒县| 惠东县| 永定县| 城市| 保亭| 大埔县| 华宁县| 黄大仙区| 衡南县| 泸水县| 密云县|