国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > PHP > 正文

php顯示錯誤信息方法

2024-07-16 17:58:56
字體:
來源:轉載
供稿:網友

  我們在瀏覽一些論壇的時候會經常遇到打開網頁是空白的情況,其實是由于php在運行過程中遇到錯誤信息而致,如果想知道那個環節出了問題就得讓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

  ; - Show all errors, except for notices

  ;error_reporting = E_ALL & ~E_NOTICE | E_STRICT

  ; - Show only errors

  ;error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR

  ; - Show all errors except for notices and coding standards warnings

  ;error_reporting = E_ALL & ~E_NOTICE

  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 = E_ALL & ~E_NOTICE | E_STRICT

; - Show only errors

;error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ERROR|E_CORE_ERROR

; - Show all errors except for notices and coding standards warnings

;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);

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 固始县| 盐津县| 道孚县| 怀仁县| 南宁市| 乌兰察布市| 灵山县| 左权县| 芦溪县| 安塞县| 保定市| 南城县| 贡山| 叶城县| 东乡族自治县| 瓮安县| 若尔盖县| 泰宁县| 洛南县| 桦南县| 台北市| 平阴县| 辉县市| 连山| 宝山区| 成武县| 夹江县| 汉阴县| 饶平县| 九龙坡区| 隆尧县| 垣曲县| 宁强县| 靖安县| 甘肃省| 教育| 怀仁县| 广州市| 建水县| 博客| 白河县|