作成日:2018-08-03, 更新日:2019-11-16
基本
▼「core/classes/httpexceptions.php」で設定してくれているhandle
400 | HttpBadRequestException |
---|---|
403 | HttpNoAccessException |
404 | HttpNotFoundException |
500 | HttpServerErrorException |
飛ばしたい
「404」に飛ばす場合
throw new HttpNotFoundException;
それぞれを自作する場合
「app/config/routes.php」で「'_404_' => 'welcome/404',」を参考に他も作っていく。
その際、ステータスコードも修正する
・「Response::forge(テンプレート, 404);」
※「core/classes/httpexceptions.php」を継承してbootstap.phpとかで読み込ませる感じ。