wangyu/tp-exception

TP5.1 的异常核心类,含多异常输出,异常类型判断

dev-master 2019-07-04 03:02 UTC

This package is auto-updated.

Last update: 2024-05-04 14:29:11 UTC


README

TP5.1 的异常基类扩展

composer 安装

composer require wangyu/tp-exception

使用说明

(1)首先继承 \WangYu\BaseException

  • 例如:
class RouteException extends \WangYu\BaseException
{
    public $code = 400;
    public $message = '反射路由设置错误';
    public $error_code = 66668;
}

(2) 修改 thinkphp5.1/config/app.php 里面 exception_handle参数

修改为以下内容

// 异常处理handle类 留空使用 \think\exception\Handle
'exception_handle'       => 'WangYu\Exception',