zoukankan      html  css  js  c++  java
  • try catch throw new exception ('message')

        try {
          echo $abc + 1 . " ";
        } catch (Exception $e) {
          echo 'Caught exception: qinqiu ',  $e->getMessage(), " ";
          throw new Exception('try a gain');
        } finally {
          echo "Second finally. ";
          $mess = new Exception('try a gain');
          echo $mess->getmessage();
        }

    --

    use exception; (manually add)
    throw new expceiton('string') -- will stop the excution
    只有在一个函数throw new Exception('Division by zero.');
    然后在调用这个函数后,调用一个catch就可以获取到$e->getMessage()

    --> 使用try catch throw new exception()  的 意义就在于不打扰整个系统的运行一般看到的还都能看到;

    use Exception; [not exception]

      function returnfalse(){
        throw  new Exception('Division by oen middlion zero.');
    //     var_dump($abc->getTrace());
    //     return FALSE;
      }
      function returntrue(){
        throw  new Exception('Division by oen middlion.');
    //     var_dump($abc->getTrace());
    //     return FALSE;
      }

    是生效的不会打乱页面只有在kint()的时候会被打印出来

    是这样的,throw出什么的exception就会要相应的exception去接收 不然就报错

    exception可以接收qexception, bexception

    exception可以接收exception,

    qaexception不能接收exception......

  • 相关阅读:
    2018.11.21 struts2获得servletAPI方式及如何获得参数
    2018.11.20 Struts2中对结果处理方式分析&struts2内置的方式底层源码剖析
    2018.11.19 Struts2中Action类的书写方式
    2018.11.18 Sturts2配置详解&常量配置进阶
    2018.11.17 Struts2框架入门
    需求分析
    可行性研究
    防火墙
    homework1
    静态网页开发技术
  • 原文地址:https://www.cnblogs.com/qinqiu/p/8031595.html
Copyright © 2011-2022 走看看