在寫php文件上傳程序時(shí)有時(shí)會(huì)出現(xiàn)這樣的警告:
- Type: image/png
- Size: 66.84765625 Kb
- Temp file: D:/Users/Aven/AppData/Local/Temp/php742F.tmp
- 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
- 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
- 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
- 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
- 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ù),問題解決。
新聞熱點(diǎn)
疑難解答