microcyan/think-help

TP的辅助工具

维护者

详细信息

gitee.com/leroiliu/mc-think-help.git

安装: 184

依赖: 0

建议者: 0

安全: 0

1.0.3 2023-09-06 05:12 UTC

This package is auto-updated.

Last update: 2024-09-06 07:10:56 UTC


README

  • tpl/config目录下的文件复制到项目的config目录下,或进行覆盖
  • tpl/.env.example复制到项目根目录,并重命名为:.env
  • app/ExceptionHandle.php中修改render方法如下:
      public function render($request, Throwable $e): Response
      {
          // 添加自定义异常处理机制
          if (get_class($e)==="MicroCyan\ThinkHelp\Exception\NotLoginException"){
              return json_error($e->getMessage(),[],501);
          }
          if (!env('app_debug')){
              return json_error($e->getMessage(),'error');
          }
          // 其他错误交给系统处理
          return parent::render($request, $e);
      }