Us. php. netmanuzhfunction. Errors below the set-error-handler.php level cannot be handled by user-defined functions: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and in... http://us.php.net/manual/zh/function.set-error-handler.php
The following errors cannot be handled by user-defined functions: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of the E_STRICT generated in the file where the set_error_handler () function is called.
/*** Custom error handling * access public * @ param int $ errno Error Type * @ param string $ errstr error message * @ param string $ errfile error file * @ param int $ errline error row * return void */static public function appError ($ errno, $ errstr, $ errfile, $ errline) {switch ($ errno) {case E_ERROR: case E_PARSE: case E_CORE_ERROR: case E_COMPILE_ERROR: case E_USER_ERROR: ob_end_clean (); $ errorStr = "$ errstr ". $ errfile. "Row $ errline. "; if (C ('Log _ RECORD ') LOG: write (" [$ errno] ". $ errorStr, Log: ERR); self: halt ($ errorStr); break; default: $ errorStr = "[$ errno] $ errstr ". $ errfile. "Row $ errline. "; self: trace ($ errorStr,'', 'notic '); break ;}}
However, thinkPHP's custom error method wants to handle these errors. How can this problem be solved? So this design is meaningless, right.
It's useless. I don't know what this design means. Please explain it!
This problem: http://segmentfault.com/q/1010000002703753/a-1020000002703757 I understand is right.
Reply content:
Http://us.php.net/manual/zh/function.set-error-handler.php
The following errors cannot be handled by user-defined functions: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of the E_STRICT generated in the file where the set_error_handler () function is called.
/*** Custom error handling * access public * @ param int $ errno Error Type * @ param string $ errstr error message * @ param string $ errfile error file * @ param int $ errline error row * return void */static public function appError ($ errno, $ errstr, $ errfile, $ errline) {switch ($ errno) {case E_ERROR: case E_PARSE: case E_CORE_ERROR: case E_COMPILE_ERROR: case E_USER_ERROR: ob_end_clean (); $ errorStr = "$ errstr ". $ errfile. "Row $ errline. "; if (C ('Log _ RECORD ') LOG: write (" [$ errno] ". $ errorStr, Log: ERR); self: halt ($ errorStr); break; default: $ errorStr = "[$ errno] $ errstr ". $ errfile. "Row $ errline. "; self: trace ($ errorStr,'', 'notic '); break ;}}
However, thinkPHP's custom error method wants to handle these errors. How can this problem be solved? So this design is meaningless, right.
It's useless. I don't know what this design means. Please explain it!
This problem: http://segmentfault.com/q/1010000002703753/a-1020000002703757 I understand is right.
Thank you! I'm not a ThinkPHP user. I have to guess.
The significance of this design is that after trigger_error () is used in the Framework to trigger a user-level error, user-defined functions are used to generate developer-friendly output.
I guess the author thinks too much about the reasons for determining E_ERROR, E_PARSE, E_CORE_ERROR, and E_COMPILE_ERROR.
There should be no problem with this design. Many frameworks manage and capture errors by themselves. The advantage is that you can control the error display information by yourself during development and production, and use logs to locate errors.
The following errors cannot be handled by user-defined functions: E_ERROR, E_PARSE, E_CORE_ERROR, E_CORE_WARNING, E_COMPILE_ERROR, E_COMPILE_WARNING, and most of the E_STRICT generated in the file where the set_error_handler () function is called.
After testing, the ob_start () series functions cannot control error output at the above level, and errors at the above level cannot be triggered by users, that is, trigger_error cannot be used for triggering.
Sorry, I am not a ThinkPHP user and do not like this, so I can't help you.