zoukankan      html  css  js  c++  java
  • 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{
                  代码块
               }
    

      

  • 相关阅读:
    trie树
    基数排序
    CF724E Goods transportation 最小割 DP
    [CQOI2009]跳舞 网络流
    NOIP2018爆零记
    斜率优化
    CF311B Cats Transport 斜率优化DP
    逆元
    卡特兰数
    【BZOJ】【1565】【NOI2009】PVZ 植物大战僵尸
  • 原文地址:https://www.cnblogs.com/achengmu/p/6229456.html
Copyright © 2011-2022 走看看