Home > Backend Development > PHP Tutorial > java软件工程师学php -16 exception处理

java软件工程师学php -16 exception处理

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 13:11:29
Original
784 people have browsed it

java程序员学php -16 exception处理
写法与java风格一致

      throw new Exception('exception', 33);  //比java多了一个error_code

      try{
        $d -> doSecond();
      }catch(Exception $e){
        echo $e.getMessage();
      }
Copy after login



不同点:
1.php里没有 throws Exception
2.php里的exception没有 checked exception 与 unchecked之分

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template