Ob_end_clean error. please advise! I want to use set_error_handler to collect errors in a unified manner. before printing the custom error prompt, I used ob_end_clean (); but reported an error.
PS: I enabled gzip.
Test code:
Error_reporting (E_ALL); set_error_handler (array ('test', 'handle _ error'); if (function_exists ('OB _ gzhandler ')) {ob_start ('OB _ gzhandler');} else {ob_start ();} class test {public static function handle_error ($ errno, $ errstr, $ errfile, $ errline) {if ($ errno) {debug: system_error ($ errstr) ;}} class debug {public static function system_error ($ message) {ob_end_clean (); echo $ message; exit;} echo 'error message
'; Trigger_error ('error content ');
If the code above is tested, an error is reported... It doesn't matter if ob_end_clean () is commented out...
I am not familiar with ob_start. please kindly advise!
Reply to discussion (solution)
By the way, the following error occurs:
In chrome
Error 330 (net: ERR_CONTENT_DECODING_FAILED): Unknown error
Error_reporting (E_ALL); set_error_handler (array ('test', 'handle _ error'); if (function_exists ('OB _ gzhandler ')) {ob_start ('My _ ob_gzhandler ');} else {ob_start ();} class test {public static function handle_error ($ errno, $ errstr, $ errfile, $ errline) {if ($ errno) {debug: system_error ($ errstr) ;}} class debug {public static function system_error ($ message) {ob_clean (); echo $ message; exit;} echo 'error message
'; Trigger_error ('ddddddddddddddddddddddddddd error content'); function my_ob_gzhandler ($ buffer, $ mod) {header ("Content-Encoding: gzip"); return gzencode ($ buffer, 9, FORCE_GZIP );}
PHP code? Struct (E_ALL); set_error_handler (array ('test', 'handle _ error'); if (function_exists ('OB _ gzhandl ......
Talent, thank you