PHP display_errors 有一些函數用於定義錯誤和警告列表以及適當且詳細的資訊。 PHP display_errors 為開發人員提供故障排除和除錯的協助。任何與 PHP 相關的應用程式因某種原因而停止,都會包含一些需要作為 PHP display_errors 的一部分顯示的錯誤或警告。執行時,display_errors 中涉及不同層級的錯誤。文件中提到的 PHP Display_error 指令在文件中出現時應始終處於「ON」模式。
開始您的免費軟體開發課程
網頁開發、程式語言、軟體測試及其他
PHP display_errors 沒有正確的語法,但是在執行 PHP 程式碼時,需要在腳本中包含一些具有特定格式的程式碼行。該行程式碼表示如下:
ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL);
哪裡,
以下是下面提到的範例
This program demonstrates the inclusion of a set of code within the ini file, but it fails as the display error and display startup error does not include parse errors depicting the exact location of the failure within the file and the output as shown.
Code:
<!DOCTYPE html> <html> <body> <?php ini_set('display_errors', 1); ini_set('display_start_up_errors', 1); error_reporting(E_ALL); include("abcd.php"); ?> </body> </html>
Output:
Note: To get the above error displayed in the proper understandable and readable format, then it is very much needed to display errors, including parse errors for which it is needed to make a change in php.ini or pgp-fpm in apache tomcat, i.e. in the working folder of apache tomcat with the following command as part of the configuration file: display_errors = ON.
This program demonstrates other types of errors that can be displayed, not necessarily including the overall PHP display_error functions. But sometimes, these kinds of errors or warnings come up with the developers as execution is almost smooth and should get easily solved.
Code:
<!DOCTYPE html> <html> <body> <?php $z = "Representation_of_Notice_Error."; echo $z; echo $Notice; ?> </body> </html>
Output:
This program demonstrates that the display_error with ini() function is enabled and restarted, as shown in the output. This warning comes into the picture when the display_error is enabled and restarted in the apache tomcat working folder.
Code:
<!DOCTYPE html> <html> <body> <?php for($h_1 = 1; $h_1 <= 8 $h_1++) { echo $h_1; } ?> </body> </html>
Output:
PHP display_error is quite an appropriate functionality as part of PHP and provides aid to programmers by providing them with the ability and flexibility to troubleshoot and debug the application easily. It makes the time consumption of debugging and troubleshooting less. Overall, It is a very efficient approach to use display_errors in PHP to get detailed information for errors and warnings as it helps in many ways.
以上是PHP 顯示錯誤的詳細內容。更多資訊請關注PHP中文網其他相關文章!