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中文网其他相关文章!