PHP 예외 생성자
예시
<?php
...
throw new Exception("Division by zero", 1);
...
?>
정의 및 사용
Exception()
생성자는 Exception 개체를 만들고 일부 속성을 설정하는 데 사용됩니다 .
통사론
new Exception(message, code, previous)
매개변수 값
Parameter | Description |
---|---|
message | Optional. A string describing why the exception was thrown |
code | Optional. An integer that can be used used to easily distinguish this exception from others of the same type |
previous | Optional. If this exception was thrown in a catch block of another exception, it is recommended to pass that exception into this parameter |
관련 페이지
PHP 예외 장 에서 예외에 대해 자세히 읽어보십시오 .
❮ PHP 예외 참조