Yii framework 笔记之自定义错误

原文网址: http://www.yiiframework.com/doc/guide/topics.error

很多推罗嗦的东西请看原文

1.如何引发错误,比如在文章不存在,或者错误操作的时候引发。

 

定义了statue状态码,还有提示的信息。

2.如何自定义显示错误的页面

 显示错误的页面按照如下顺序来寻找:

 
  1. WebRoot/themes/ThemeName/views/system: this is the system view directory under the currently active theme.

  2. WebRoot/protected/views/system: this is the default system view directory for an application.

  3. yii/framework/views: this is the standard system view directory provided by the Yii framework.

第一个是跟主题相关的,第二个是跟主题无关,第三个是系统通用的。

3.在自定义错误页面里面可以使用什么样的变量

  • code: the HTTP status code (e.g. 403, 500);
  • type: the error type (e.g. CHttpException, PHP Error);
  • message: the error message;
  • file: the name of the PHP script file where the error occurs;
  • line: the line number of the code where the error occurs;
  • trace: the call stack of the error;
  • source: the context source code where the error occurs.
  •  

     

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值