為什麼 PHP 會出現空白頁面?


這是因為我們的伺服器會關閉所有 PHP 的 error message 輸出,當客戶的 PHP 程式語法錯誤,或執行時出錯而導而 PHP 不能執行,便會看到空白頁面,而不會輸出錯誤.

 

如果客戶需要查看 error mesage 進行 debug,可以在 php 程式的第一行,加入以下一句查看所有 error message, 方便 debug:

<?php
error_reporting(E_ALL);

// your php code here

?>

Last update:
2018-05-05 02:29
Author:
Sam Tang
Revision:
1.1
Average rating:0 (0 Votes)

You cannot comment on this entry

Chuck Norris has counted to infinity. Twice.