Editing
Troubleshooting of PHP errors
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== PHPExcel 產生的 Excel 檔案,開啟後看到一堆亂碼 === 狀況1: 開啟 Excel 檔案,看到最前面有 {{kbd | key=<nowiki>NOTICE</nowiki>}} 的錯誤訊息,例如 {{kbd | key=<nowiki><b>Notice</b>: Constant CONST_XXX already defined in <b>path\to\script.php</b> on line xx</nowiki>}} * 解法: 關閉錯誤訊息輸出 ex: [http://www.php.net/manual/en/function.error-reporting.php error_reporting(0);] 以及修正 NOTICE 訊息指涉的問題,例如例子中常數重複宣告的問題。 狀況2: 開啟 Excel 檔案,看到最前面有 {{kbd | key=<nowiki>Fatal error</nowiki>}} 之類的錯誤訊息 * 解法: 關閉錯誤訊息輸出 ex: [http://www.php.net/manual/en/function.error-reporting.php error_reporting(0);] ,以及修正 Fatal error 訊息指涉的問題。 狀況3: 開啟 Excel 檔案,看到有儲存格位址之類的錯誤訊息 * 解法: 該儲存格內容以等號 (=) 開始,卻不是函數。解決方式是將儲存格內容的最前面加一個單引號 (') 或者是加個空白。
Summary:
Please note that all contributions to LemonWiki共筆 are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
LemonWiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Current events
Recent changes
Random page
Help
Categories
Tools
What links here
Related changes
Special pages
Page information