php檢視錯誤的方法:1、透過設定【php.ini】中的參數設定PHP的錯誤等級可以在php.ini適當的位置增加一行;2、透過PHP函數【error_reporting】設定PHP報錯級別。
php查看錯誤的方法:
一、透過設定php.ini中的參數設定PHP的報錯等級可以在php.ini適當的位置增加一行
error_reporting=E_ALL CODE:[COPY] error_reporting=E_ALL
註:php.ini中實作給了一些例子,像是我本地的php.ini就有如下
;Examples:
;-Show all errors,except for notices and coding standards warnings
;error_reporting=E_ALL&~E_NOTICE
#;error errors ,except for notices;error_reporting=E_ALL&~E_NOTICE|E_STRICT;-Show only errors#;error_reporting=E_COMPILE_ERROR|E_RECOVERABLE_##;error_reporting=E_COMPILE_ERROR|E_RECOVERABLE_##;error_reporting=E_COMPILE_ERROR|E_RECOVERABLE_##ERROR_ERROR #;-Show all errors except for notices and coding standards warnings;error_reporting=E_ALL&~E_NOTICE#CODE:[COPY]##;Examples:
##CODE:[COPY]
##;Examples:;-Show all errors,except for notices and coding standards warnings
;error_reporting=E_ALL&~E_NOTICE
#;-Show all errors,except for notices
##;error_reporting=;error_reporting=; E_ALL&~E_NOTICE|E_STRICT;-Show only errors;error_reporting=E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR #E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR#n 可以#vallv-S how ;error_reporting=E_ALL&~E_NOTICE我只要在這些行程式碼的下面增加error_reporting=E_ALL然後重新啟動web服務就可以了二、通過PHP函數error_reporting設定PHP錯誤等級
如果你無權修改php.ini中的參數配置,你可以透過這個函數來設定錯誤等級。 error_reporting()函數使用方法error_reporting(report_level)如果參數level未指定,目前報錯等級將會傳回。 任意數目的以上選項都可以用「或」來連接(用OR或|),這樣可以報告所有需要的各層級錯誤。例如,下面的程式碼關閉了使用者自訂的錯誤和警告,執行了某些操作,然後恢復到原始的報錯等級://停用錯誤報告##error_reporting(0) ;
//報告執行階段錯誤
error_reporting(E_ERROR|E_WARNING|E_PARSE);
//報告所有錯誤
error_reporting(E_ALL);
CODE:[COPY]
//停用錯誤報告
error_reporting(0);
//報告執行階段錯誤
#error_reporting(E_ERROR | E_WARNING | E_PARSE);
//回報所有錯誤
error_reporting(E_ALL);
#那麼我們就可以把論壇裡的include/common. inc.php檔案裡的
error_reporting(0); CODE:[COPY] error_reporting(0);
修改成
error_reporting(E_ALL); CODE:[COPY] error_reporting(E_ALL);
然後儲存,這樣就可以看到PHP 報告的錯誤訊息了
想了解更多編程學習,敬請關注php培訓
以上是php如何查看錯誤的詳細內容。更多資訊請關注PHP中文網其他相關文章!

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

SublimeText3 Linux新版
SublimeText3 Linux最新版

ZendStudio 13.5.1 Mac
強大的PHP整合開發環境

SecLists
SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

WebStorm Mac版
好用的JavaScript開發工具

PhpStorm Mac 版本
最新(2018.2.1 )專業的PHP整合開發工具