php不能try-catch-fnally里面在嵌套try-catch-fnall,否则本来执行时间不长的程序,会被执行更长时间,这是php的bug吗?
如:
try{ 代码块 }catch (Exception $e) { echo get_class($e), ": ", $e->getMessage(), " "; echo " File=", $e->getFile(), " "; echo " Line=", $e->getLine(), " "; echo $e->getTraceAsString(); }finally{ try{ 代码块 }catch (Exception $e) { echo get_class($e), ": ", $e->getMessage(), " "; echo " File=", $e->getFile(), " "; echo " Line=", $e->getLine(), " "; echo $e->getTraceAsString(); }finally{ 代码块 } }
应该改成:
try{ 代码块 }catch (Exception $e) { echo get_class($e), ": ", $e->getMessage(), " "; echo " File=", $e->getFile(), " "; echo " Line=", $e->getLine(), " "; echo $e->getTraceAsString(); }finally{ 代码块 } try{ 代码块 }catch (Exception $e) { echo get_class($e), ": ", $e->getMessage(), " "; echo " File=", $e->getFile(), " "; echo " Line=", $e->getLine(), " "; echo $e->getTraceAsString(); }finally{ 代码块 }