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

      

  • 相关阅读:
    linux 内核配置
    使用 git 下载linux 源码
    订阅 linux 邮件列表注意的问题
    使用反射创建一维数组和二维数组
    反射API
    反射机制
    集合案例--对ArrayList容器中的内容进行排序
    Collections
    TreeSet
    Set容器
  • 原文地址:https://www.cnblogs.com/achengmu/p/6229456.html
Copyright © 2011-2022 走看看