How to check errors in php: 1. Set the error level of PHP by configuring the parameters in [php.ini]. You can add a line in the appropriate position in php.ini; 2. Set the error level through the PHP function [error_reporting]. Set the PHP error level.
How to check the error in php:
1. By configuring the parameter settings in php.ini The error level of PHP can be added by adding a line at the appropriate location in php.ini
error_reporting=E_ALL CODE:[COPY] error_reporting=E_ALL
Note: The implementation in php.ini gives some examples, for example, my local php.ini has the following
;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_NOTICECODE:[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_NOTICEI just need to add error_reporting=E_ALL below these lines of code and then restart the web service.2. Pass The PHP function error_reporting sets the PHP error reporting level
If you do not have the permission to modify the parameter configuration in php.ini, you can set the error reporting level through this function. Error_reporting() function usage methoderror_reporting(report_level)If the parameter level is not specified, the current error level will be returned. Any number of the above options can be connected with "OR" (using OR or |), so that all required levels of errors can be reported. For example, the following code turns off user-defined errors and warnings, performs certain operations, and then returns to the original error level: //Disable error reportingerror_reporting(0) ;//Report runtime errorserror_reporting(E_ERROR|E_WARNING|E_PARSE);//Report all errorserror_reporting(E_ALL); CODE:[COPY]//Disable error reportingerror_reporting(0);//Report runtime errorserror_reporting(E_ERROR | E_WARNING | E_PARSE);//Report all errorserror_reporting(E_ALL);Then we can include/common in the forum. Changeerror_reporting(0); CODE:[COPY] error_reporting(0);in the inc.php file to
error_reporting(E_ALL); CODE:[COPY] error_reporting(E_ALL);and save it, so that you can see the error message reported by PHP
Want to learn more about programming To learn, please pay attention to thephp training column!
The above is the detailed content of How to check errors in php. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

WebStorm Mac version
Useful JavaScript development tools

Dreamweaver CS6
Visual web development tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.
