Loading...

在PHP強制顯示錯誤訊息的方法

Temperature: 0 °C

Mark ChangMark Chang
author_tools

若是單一檔案,只需要在每個PHP檔案裡添加下列2行:

ini_set('display_errors','1');
error_reporting(E_ALL);

若想要所有檔案都顯示錯誤訊息。

可以在.htaccess文件中添加了以下幾行:
php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_flag log_errors on
php_value error_log /home/path/public_html/domain/PHP_errors.log

反之,若添加的是Off 則不會顯示錯誤訊息。

當然也可以直接在php.ini中設定。

在 php.ini 一般預設路徑在 /etc/php.ini, 在 php.ini 內找到 display_errors,設定為 On 是開啟錯誤信息,Off 是關閉輸出:
isplay_errors = On // 開啟錯誤提示
display_errors = Off // 關閉錯誤提示

以上紀錄~
 

https://innstory.com/story-在PHP強制顯示錯誤訊息的方法-2126
PHP

Prev
 RPO(Relative_Path_Overwrite)相對路徑覆蓋攻擊

Next
分享_吃蝗蟲治武漢肺炎中國網民樂翻:天賜良藥! 

About the Author

Mark Chang

離不開電腦的宅男

Visitor message

Leave some footprints to prove that you visited me

Recommended reading

Author's other related stories

js判斷字母是否為大小寫

js判斷字母是否為大小寫

使用JS來判斷字串裡是否含有大寫字母或小寫字母。 //判斷是否含有大寫字母 function chk...

讓文字左右對齊

讓文字左右對齊

讓文字左右對齊這類的設計案,通常都會出現在平面設計居多。 網頁上很少會遇到客戶會執著於這方面,但不能...

解決iphone 不能使用colorbox 滑動的方式

解決iphone 不能使用c...

pexelsphotoiphone #cboxLoadedContent, #cboxContent...

Please select an option

error

Hi, thank you for your participation, but you cannot vote repeatedly~

Join innstory now and start recording your story.

"Innstory" is a place to store stories. We are committed to becoming a warm platform. Deepening the bonds between people is our direction.
We are convinced that the blockchain between people is not just a cold calculation. Join us now.

Wrong format