Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/china-wangyu/tp-exception
TP5.1 的异常基类扩展
https://github.com/china-wangyu/tp-exception
Last synced: about 2 months ago
JSON representation
TP5.1 的异常基类扩展
- Host: GitHub
- URL: https://github.com/china-wangyu/tp-exception
- Owner: china-wangyu
- License: mit
- Created: 2019-07-03T07:33:20.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-07-04T03:02:27.000Z (over 5 years ago)
- Last Synced: 2024-05-03T17:05:56.834Z (8 months ago)
- Language: PHP
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tp-exception
TP5.1 的异常基类扩展# `composer` 安装
```php
composer require wangyu/tp-exception
```# 使用说明
## (1)首先继承 `\WangYu\BaseException`
- 例如:
```php
class RouteException extends \WangYu\BaseException
{
public $code = 400;
public $message = '反射路由设置错误';
public $error_code = 66668;
}
```## (2) 修改 `thinkphp5.1` 的 `/config/app.php` 里面 `exception_handle`参数
修改为以下内容
```php
// 异常处理handle类 留空使用 \think\exception\Handle
'exception_handle' => 'WangYu\Exception',
```