Php error report enabling detailed implementation

Source: Internet
Author: User
Tags php error zend

Definition and usage
Error_reporting () sets the php error level and returns the current level.

Syntax
Error_reporting (report_level) if the level parameter is not specified, the current error level will be returned. The following items are possible values of level.

*/
// Close all error reports
Error_reporting (0 );
// Only report running errors
Error_reporting (e_error | e_warning | e_parse );
// Report e_notice
Error_reporting (e_error | e_warning | e_parse | e_notice );
// Report all running errors except e_notice
// This is the default value of php. ini.
Error_reporting (e_all ^ e_notice );
// Report all php errors
Error_reporting (e_all );
// The same effect as error_reporting (e_all). This setting also reports all php errors.
Ini_set ('error _ report', e_all );

/*

Value constant description
1 e_error fatal run-time errors. errors that can not be recovered from. execution of the script is halted
2 e_warning non-fatal run-time errors. execution of the script is not halted
4 e_parse compile-time parse errors. parse errors shoshould only be generated by the parser
8 e_notice run-time notices. the script found something that might be an error, but cocould also happen when running a script normally
16 e_core_error fatal errors at php startup. this is like an e_error in the php core
32 e_core_warning non-fatal errors at php startup. this is like an e_warning in the php core
64 e_compile_error fatal compile-time errors. this is like an e_error generated by the zend scripting engine
128 e_compile_warning non-fatal compile-time errors. this is like an e_warning generated by the zend scripting engine
256 e_user_error fatal user-generated error. this is like an e_error set by the programmer using the php function trigger_error ()
512 e_user_warning non-fatal user-generated warning. this is like an e_warning set by the programmer using the php function trigger_error ()
1024 e_user_notice user-generated notice. this is like an e_notice set by the programmer using the php function trigger_error ()
2048 e_strict run-time notices. php suggest changes to your code to help interoperability and compatibility of the code
4096 e_recoverable_error catchable fatal error. this is like an e_error but can be caught by a user defined handle (see also set_error_handler ())
8191 e_all all errors and warnings, except T level e_strict (e_strict will be part of e_all as of php 6.0)

*/

Function unserialize_handler ($ errno, $ errstr) // user-defined function
{
Echo "invalid serialized value. n"; // output the specified content
}
$ Serialized = 'foo'; // define a string
Set_error_handler ('unserialize _ handler'); // sets the user-defined error message function.
$ Original = unserialize ($ serialized); // Create a php value from a stored representation
Restore_error_handler (); // restore error message pointer

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.