Home >Backend Development >PHP Problem >How to prompt all errors in php

How to prompt all errors in php

藏色散人
藏色散人Original
2022-11-21 09:53:521903browse

How to implement php to prompt all errors: 1. Create a php file; 2. Define a function "function show_all_errors(){...}"; 3. Write "if(! ini_get('display_errors')){ini_set('display_errors','On');}error_reporting(E_ALL);" The statement can be used to display all PHP errors.

How to prompt all errors in php

The operating environment of this tutorial: Windows 7 system, PHP version 8.1, Dell G3 computer.

php How to prompt all errors?

PHP Manually enable display of all errors

I often encounter the problem that the configuration of php.ini prevents PHP execution errors from being displayed. It is really troublesome to change php.ini every time. , so simply write a function to display all PHP errors (very convenient to use in various debugging modes):

function show_all_errors(){
if(!ini_get('display_errors')){
ini_set('display_errors','On');
}
error_reporting(E_ALL);
}

Recommended study: "PHP Video Tutorial"

The above is the detailed content of How to prompt all errors in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn