發(fā)表日期:2018-12 文章編輯:小燈 瀏覽次數(shù):4506
一旦拋出了HttpException
異常,可以支持定義單獨(dú)的異常頁面的模板地址,只需要在應(yīng)用配置文件中增加:
'http_exception_template'=>[// 定義404錯(cuò)誤的重定向頁面地址404 =>APP_PATH.'404.html',// 還可以定義其它的HTTP status401 =>APP_PATH.'401.html',]
模板文件支持模板引擎中的標(biāo)簽。
http_exception_template
配置僅在部署模式下面生效。
一般來說HTTP
異常是由系統(tǒng)自動(dòng)拋出的,但我們也可以手動(dòng)拋出
throw new \think\exception\HttpException(404, '頁面不存在');
或者通過助手函數(shù)abort
手動(dòng)拋出HTTP
異常,例如:
abort(404,'頁面不存在');
日期:2018-12 瀏覽次數(shù):4937
日期:2018-12 瀏覽次數(shù):5219
日期:2018-12 瀏覽次數(shù):4295
日期:2018-12 瀏覽次數(shù):3650
日期:2018-12 瀏覽次數(shù):4045
日期:2018-12 瀏覽次數(shù):3616
日期:2018-12 瀏覽次數(shù):3661
日期:2018-12 瀏覽次數(shù):6482
日期:2018-12 瀏覽次數(shù):3423
日期:2018-12 瀏覽次數(shù):3532
日期:2018-12 瀏覽次數(shù):3652
日期:2018-12 瀏覽次數(shù):4777
日期:2018-12 瀏覽次數(shù):3166
日期:2018-12 瀏覽次數(shù):3486
日期:2018-12 瀏覽次數(shù):3294
日期:2018-12 瀏覽次數(shù):3169
日期:2018-12 瀏覽次數(shù):3549
日期:2018-12 瀏覽次數(shù):3410
日期:2018-12 瀏覽次數(shù):4505
日期:2018-12 瀏覽次數(shù):3960
日期:2018-12 瀏覽次數(shù):3478
日期:2018-12 瀏覽次數(shù):4261
日期:2018-12 瀏覽次數(shù):3261
日期:2018-12 瀏覽次數(shù):3238
日期:2018-12 瀏覽次數(shù):3200
日期:2018-12 瀏覽次數(shù):3354
日期:2018-12 瀏覽次數(shù):3647
日期:2018-12 瀏覽次數(shù):3433
日期:2018-12 瀏覽次數(shù):3375
日期:2018-12 瀏覽次數(shù):3429
Copyright ? 2013-2018 Tadeng NetWork Technology Co., LTD. All Rights Reserved.