• php: 不能嵌套try-catch-fnally,否则执行时间过长


    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{
                  代码块
               }
    

      

  • 相关阅读:
    BUAA_OO_2020_Unit3 Summary
    BUAA_OO_2020_Unit2 Summary
    DataFrame的遍历
    ESMM提升CVR的论文summary
    FaceBook 关于提升CTR的论文研究
    OO终章·GRAND BATTLE
    第三单元规格作业博客总结
    OO电梯单元作业总结
    【OO多项式求导作业总结】
    提问回顾与个人总结
  • 原文地址:https://www.cnblogs.com/achengmu/p/6229456.html
Copyright © 2020-2023  润新知