出錯訊息
在 php.ini 檔案中開啟錯誤報告並設定錯誤報告的級別:
display_errors 變數的目的很明顯 —— 它告訴 php 是否顯示錯誤。預設值是off
。但是,要讓開發過程更加輕鬆,請把這個值設為on
:
display_errors = on
error_reporting
變數的預設值是e_all
。這個設定會顯示從不良編碼實踐到無害提示到出錯的所有資訊。e_all
對於開發過程來說有點太細,因為它在螢幕上為一些小事(例如變數未初始化)也顯示提示,會搞糟瀏覽器的輸出。我只想看到錯誤和不良編碼實踐,但是不想看到無害的提示。所以,請用以下值代替error_reporting
的預設值:
error_reporting = e_all & ~e_notice
重新啟動 apache,就全部設定好了。
php 除錯程式
在執行時必須知道某個變數為何值。我是這樣做的,建立一檔案debug.php,其內容如下 php php ob start session start echo pre echo 本頁得到的 get變數有 print r get echo 本頁得到的 post變數有 print r post echo...
xdebug除錯php程式
xdebug.default enable 1 預設是1,當錯誤出現時,堆疊跟蹤會啟用。可以在 中通過xdebug disable 來關閉它。xdebug.force display errors 0 預設是0,如果設定為1,錯誤總是會被展示,不管php的display errors是怎麼設定的。x...
PHP xdebug 幫助除錯php 程式
以下步驟為使用source 包去安裝xdebug軟體包。tar xzf xdebug 2.1.0.tgz cd xdebug 2.1.0 phpize configure enable xdebug 如果提示找不到php config 則請用以下命令編譯 configure enable xdebu...