microcyan/think-help

TP的辅助工具

1.0.3 2023-09-06 05:12 UTC

This package is auto-updated.

Last update: 2024-04-06 06:18:03 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);
      }