Note: 1. throwexception if it is not captured by the corresponding catch block, it will be passed to the top-level exception processor (if set) 2. the getTrace () method of the exception object can trace the function in which the exception is thrown. the exception information we want to handle generally includes four types: getMessage and getFile.
Note: 1. throwexception if it is not captured by the corresponding catch block, it will be passed to the top-level exception processor (if set) 2. the getTrace () method of the exception object can trace the function in which the exception is thrown. the exception information we want to handle generally includes four types: getMessage and getFile.
Note:
1. throw exception if it is not captured by the corresponding catch block, it will be passed to the top-level exception processor (if it is set)
2. The getTrace () method of the exception object can trace the function in which the exception is thrown.
3. The exception information to be processed generally includes four types: getMessage, getFile, getLine, and debug_print_backtrace)
4. thinkphp only throws an exception in two ways: 1. throw new throwing iton 2. throw_exception ().
5. After an exception is thrown, a catch block or top-level exception processor will be found. Other code will not be executed. <无>
GetMessage (); $ trace = $ e-> getTrace (); // if throw_exception is thrown, the location where throw_exception is called is located. if ($ trace [0] ['function'] = 'Throw _ exception ') {$ error ['file'] = $ trace [0] ['file']; $ error ['line'] = $ trace [0] ['line'];} else {// directly throw an exception $ error ['file'] = $ e-> getFile (); $ error ['line'] = $ e-> getLine ();} // debug information // $ error ['track'] = debug_print_backtrace (); // call the exception template output to // include C ('temp _ EXCEPTION_FILE '); print_r ($ error) ;}} functio N throw_exception ($ message) {throw new Exception ($ message);} throw_exception ('exception thrown in the throw_exception Function !, Will locate the location of the throw_exception call ');