반응형
메뉴얼
http://php.net/manual/en/language.exceptions.php
예제1)
if ($step>0) throw new Exception();
예제2)
function inverse($x) {
if (!$x) {
throw new Exception('Division by zero.');
}
return 1/$x;
}
예제3)
try {
print "this is our try block\n";
throw new Exception();
} catch (Exception $e) {
print "something went wrong\n";
} finally {
print "This part is always executed\n";
}
getMessage() getCode()등 설명
https://www.guru99.com/error-handling-and-exceptions.html
PHP5.5: Try/Catch/Finally
https://adayinthelifeof.nl/2013/02/12/php5-5-trycatchfinally/
PHP에서 try-catch 구문을 통한 예외처리와 확장방법
http://dev.epiloum.net/1140
반응형
'프로그래밍' 카테고리의 다른 글
연습: 1~10까지 배열 생성후 1부터 하나씩 배열에서 빼는 방법 (0) | 2021.07.05 |
---|---|
PHP 날짜형식 DATA ATOM (0) | 2021.07.04 |
MySQL 주기적 Optimize 자동화 (0) | 2021.06.26 |
PHP IF문 축약형 (0) | 2021.06.26 |
자바 JDK 설치 환경변수 설정방법 (0) | 2016.03.11 |