当前位置:首页>php>别再把代码写烂了,还怪 PHP 不行

别再把代码写烂了,还怪 PHP 不行

  • 2026-03-18 15:27:35
别再把代码写烂了,还怪 PHP 不行

商务合作加微信:2230304070 

学习与交流:PHP技术交流微信群 

2025年 JetBrains全家桶通用激活码&账号 支持最新版本

https://web.52shizhan.cn


推荐标题

  • 热门版:
     《别再把代码写烂了,还怪 PHP 不行》
  • 专业版:
     《从“面条代码”到“整洁架构”:Hyperf 生产级重构指南》
  • 硬核版:
     《打破偏见:用现代 PHP 姿势解锁 Hyperf 的真正实力》

引言:PHP 真的“不行”吗?

每当聊起 PHP,总有人露出一副“懂行”的表情:“这语言上限太低,写出来的代码全是乱麻。”

慢着。你骂的真的是 PHP 吗? 还是说,你只是在为那些“无分层、无测试、上线即跑路”的代码找替罪羊?

今天,我们以 Hyperf 框架下的“用户注册”功能为例,看看“脚本小子”与“专业开发者”的代码差距究竟在哪里。


一、 警惕:毁掉 Hyperf 的“面条式”写法

很多人把 Hyperf 当成带协程的 index.php。在他们手里,控制器(Controller)变成了逻辑垃圾场:

// ❌ 典型反模式:控制器塞满逻辑classAuthControllerextendsAbstractController{publicfunctionregister(){        $email = $this->request->input('email');        $password = $this->request->input('password');// 验证、查库、哈希、发邮件、角色分配... 全部堆在这里// 甚至直接用 DB::select("SELECT * FROM users WHERE email = '$email'") 拼 SQL// 报错直接 throw,前端直接收 500 Internal Server Error    }}

能跑吗?能。可维护吗?零。 Hyperf 的核心是 DI(依赖注入)和 AOP(切面编程),它的设计哲学是鼓励解耦

二、 现代方案:基于整洁架构的五步重构

我们要构建的不仅是功能,而是一个分层明确、职责单一的系统。

Step 1: 数据载体——定义 DTO

不要在层与层之间传递散乱的 array。使用 DTO(Data Transfer Object)确保类型安全。

namespaceApp\Dto;useHyperf\Contract\Arrayable;useHyperf\Context\Context;/** * 使用 Hyperf 3.1+ 的 Data 属性实现自动映射与验证 */#[\Hyperf\Data\Attributes\Data]classRegisterUserDtoimplementsArrayable{publicfunction__construct(        public string $email,        public string $password    ){}publicstaticfunctionfromRequest(array $data)self{returnnewself(            email: trim($data['email'] ?? ''),            password: (string)($data['password'] ?? '')        );    }publicfunctiontoArray()array{return ['email' => $this->email, 'password' => $this->password];    }}

Step 2: 领域异常——让错误语义化

别再让前端去猜 500 错误了。定义具体的领域异常,配合 Hyperf 的全局异常处理器(ExceptionHandler)使用。

namespaceApp\Exception\Domain;useHyperf\Server\Exception\ServerException;classEmailAlreadyTakenExceptionextendsServerException{protected $code = 400;protected $message = '该邮箱已被注册';}

Step 3: 数据持久层——Repository 模式

Repository 负责屏蔽数据库细节。未来无论你换成数据库还是缓存,Service 层都不需要改动。

interfaceUserRepositoryInterface{publicfunctionexistsByEmail(string $email)bool;publicfunctioncreate(array $attributes)User;}classUserRepositoryimplementsUserRepositoryInterface{publicfunctionexistsByEmail(string $email)bool{return User::where('email', $email)->exists();    }publicfunctioncreate(array $attributes)User{return User::create($attributes);    }}

Step 4: 核心业务——Service 逻辑编排

这是最关键的一步:Service 只关心业务逻辑,不关心 Request,也不关心 Response。

namespaceApp\Service\User;useApp\Dto\RegisterUserDto;useApp\Exception\Domain\{EmailAlreadyTakenExceptionInvalidEmailException};useApp\Repository\User\UserRepositoryInterface;useHyperf\Di\Annotation\Inject;usePsr\EventDispatcher\EventDispatcherInterface;classRegisterUserService{#[Inject]protected UserRepositoryInterface $userRepository;#[Inject]protected EventDispatcherInterface $eventDispatcher;publicfunctionhandle(RegisterUserDto $dto)array{// 1. 业务规则校验if (!filter_var($dto->email, FILTER_VALIDATE_EMAIL)) thrownew InvalidEmailException();if ($this->userRepository->existsByEmail($dto->email)) thrownew EmailAlreadyTakenException();// 2. 执行核心动作        $user = $this->userRepository->create(['email' => $dto->email,'password' => password_hash($dto->password, PASSWORD_ARGON2ID),        ]);// 3. 异步解耦:触发事件(如发送欢迎邮件)$this->eventDispatcher->dispatch(new UserRegistered($user));return ['user_id' => $user->id];    }}

Step 5: 控制器——薄如蝉翼的胶水层

现在的 Controller 只负责:接收参数 -> 调用服务 -> 返回响应

#[Controller(prefix: 'auth')]classAuthControllerextendsAbstractController{#[Inject]protected RegisterUserService $registerService;#[Post('/register')]publicfunctionregister()ResponseInterface{        $dto = RegisterUserDto::fromRequest($this->request->all());        $result = $this->registerService->handle($dto);return$this->response->json(['status' => 'success','data' => $result        ]);    }}

三、 维度提升:为业务编写单元测试

既然解耦了,测试就变得极其简单。Hyperf 的 Hyperf\Testing 允许你在不启动 Swoole 的情况下秒级完成测试。

publicfunctiontestRegisterSuccess(){// Mock 掉数据库依赖    $repo = m::mock(UserRepositoryInterface::class);    $repo->shouldReceive('existsByEmail')->andReturn(false);    $repo->shouldReceive('create')->once()->andReturn((object)['id' => 99]);$this->getContainer()->set(UserRepositoryInterface::class, $repo);    $service = $this->getContainer()->get(RegisterUserService::class);    $result = $service->handle(new RegisterUserDto('test@me.com''12345678'));$this->assertEquals(99, $result['user_id']);}

结语:架构决定上限

Hyperf 提供了协程、DI、注解等强大的“武器”,但它不会阻止你把代码写成一团乱麻。

性能上去了,不代表可维护性可以掉进沟里。 下次听到有人说“PHP 乱”时,你可以把这段代码发给他,然后问他:

“是你写的乱,还是你根本没用现代 PHP 的方式去思考?”

毕竟,代码质量的锅,语言不背,框架也不背。


针对这段架构的 ExceptionHandler(异常处理器)代码示例

既然架构已经分层,那么全局异常处理器(Exception Handler)就是实现“优雅返回”的最后一块拼图。

在现代 PHP 开发中,我们不应该在 Controller 里写满 try-catch。相反,我们应该让异常自然抛出,由专门的 Handler 捕捉并统一格式化。

核心逻辑:异常处理流向图

第一步:定义基础异常类

建议为业务定义一个基类,方便统一拦截处理。

namespaceApp\Exception;useHyperf\Server\Exception\ServerException;useThrowable;/** * 业务异常基类 */abstractclassBusinessExceptionextendsServerException{publicfunction__construct(string $message = "", int $code = 400, ?Throwable $previous = null){parent::__construct($message, $code, $previous);    }}
第二步:编写全局异常处理器

在 app/Exception/Handler 目录下创建 AppExceptionHandler.php。它会捕获所有未被处理的异常。

namespaceApp\Exception\Handler;useApp\Exception\BusinessException;useHyperf\Contract\StdoutLoggerInterface;useHyperf\ExceptionHandler\ExceptionHandler;useHyperf\HttpMessage\Stream\SwooleStream;usePsr\Http\Message\ResponseInterface;useThrowable;classAppExceptionHandlerextendsExceptionHandler{publicfunction__construct(protected StdoutLoggerInterface $logger){}publicfunctionhandle(Throwable $throwable, ResponseInterface $response){// 1. 处理自定义的业务异常 (如:邮箱已存在、密码太弱)if ($throwable instanceof BusinessException) {// 阻止异常继续向上传递$this->stopPropagation();return$this->formatResponse($response, $throwable->getMessage(), $throwable->getCode());        }// 2. 处理系统级异常 (如:代码 Bug、数据库连接断开)$this->logger->error(sprintf('%s[%s] in %s', $throwable->getMessage(), $throwable->getLine(), $throwable->getFile()));$this->logger->error($throwable->getTraceAsString());return$this->formatResponse($response, 'Internal Server Error'500);    }/**     * 判断该处理器是否处理此异常     */publicfunctionisValid(Throwable $throwable)bool{returntrue;    }protectedfunctionformatResponse(ResponseInterface $response, string $msg, int $code)ResponseInterface{        $data = json_encode(['ok'    => false,'code'  => $code,'error' => $msg,        ], JSON_UNESCAPED_UNICODE);return $response->withHeader('Content-Type''application/json')                        ->withStatus($code === 500 ? 500 : 200// 业务错误通常返回 200 或 4xx                        ->withBody(new SwooleStream($data));    }}
第三步:在配置中启用

打开 config/autoload/exceptions.php,将你的处理器放到最前面:

return ['handler' => ['http' => [            App\Exception\Handler\AppExceptionHandler::class, // 放在第一位        ],    ],];
带来的改变

重构后,你的 Controller 将会变得无比干净,甚至连 try-catch 都不需要:

// 现在的 AuthControllerpublicfunctionregister()ResponseInterface{    $dto = RegisterUserDto::fromRequest($this->request->all());// 如果 Service 内部抛出 EmailAlreadyTakenException (继承自 BusinessException)// 异常会自动跳过后续代码,被 AppExceptionHandler 捕获并返回标准的 JSON    $result = $this->registerService->handle($dto);return$this->response->json(['ok' => true'data' => $result]);}

总结

这就是现代 PHP 的“整洁之道”:

  1. DTO
     保证数据准入;
  2. Service
     专注于纯粹的业务逻辑;
  3. Exception Handler
     统一收尾。

这样写出来的 PHP 代码,谁还敢说它“乱”?

如何配置 Hyperf 的 Event 监听器,实现注册后自动异步发邮件的逻辑?

在传统的 PHP 脚本里,注册完用户接着写 sendMail(),如果邮件服务器卡了 5 秒,用户就会在注册页面转 5 秒圈圈。但在 Hyperf 中,我们利用 EventDispatcher 结合 协程 或 投递到异步队列,可以让用户瞬间收到“注册成功”的响应,而邮件在后台慢慢发。

以下是实现“注册成功 -> 自动发邮件”的优雅姿势:

第一步:定义事件 (Event)

事件只是一个简单的“传声筒”,用来携带业务数据。

namespaceApp\Event;useApp\Model\User;/** * 用户注册成功事件 */classUserRegistered{publicfunction__construct(public User $user){}}

第二步:编写监听器 (Listener)

监听器负责具体的“杂活”(发邮件、发短信、送积分)。

namespaceApp\Listener;useApp\Event\UserRegistered;useHyperf\Event\Annotation\Listener;useHyperf\Event\Contract\ListenerInterface;useHyperf\Contract\StdoutLoggerInterface;useHyperf\Di\Annotation\Inject;#[Listener]classSendWelcomeMailListenerimplementsListenerInterface{#[Inject]protected StdoutLoggerInterface $logger;publicfunctionlisten()array{// 声明监听哪些事件return [            UserRegistered::class,        ];    }/**     * @param UserRegistered $event     */publicfunctionprocess(object $event)void{        $user = $event->user;// 模拟发邮件逻辑$this->logger->info("正在向 {$user->email} 发送欢迎邮件...");// 建议:此处可以用 co::sleep(1) 模拟耗时,或者投递到异步队列// 在 Hyperf 中,监听器默认在当前协程执行,// 如果想完全不阻塞主流程,可以配合注解或异步队列组件使用    }}

第三步:触发事件

回到我们之前的 RegisterUserService,只需要一行代码即可解耦:

// app/Service/User/RegisterUserService.phppublicfunctionhandle(RegisterUserDto $dto)array{// ... 前面的校验和创建逻辑 ...    $user = $this->userRepository->create(['email' => $dto->email,'password' => password_hash($dto->password, PASSWORD_ARGON2ID),    ]);// 🚀 核心:触发事件,Service 不需要关心后续有多少个动作(发邮件、送礼包等)$this->eventDispatcher->dispatch(new UserRegistered($user));return ['user_id' => $user->id];}

架构优势:解耦带来的快感

  1. 开闭原则
    :如果以后产品经理说“注册成功后还要给用户发 10 块钱优惠券”,你只需要新增一个 Listener 即可,完全不需要修改RegisterUserService 的代码。
  2. 性能优化
    :你可以轻松地在 Listener 中开启一个新的协程来处理邮件发送,或者配合 hyperf/async-queue 组件将其丢入 Redis 队列,实现真正的异步。
  3. 可测试性
    :在单元测试中,你可以 Mock 掉 EventDispatcher,确保测试只关注注册逻辑,而不去触发真实的邮件发送。

总结

现在,你的系统已经具备了:

  • DTO
    :严谨的输入。
  • Service
    :纯净的业务逻辑。
  • Repository
    :标准的数据存取。
  • Exception Handler
    :优雅的错误反馈。
  • Event System
    :灵活的业务扩展。

这套组合拳打下来,谁还敢说 PHP 只适合写小脚本?这已经是标准的企业级生产架构了。

参考链接:
以上就是本篇分钟的全部内容,希望各位程序员们努力提升个人技术。最后,小编温馨提示:每天阅读5分钟,每天学习一点点,每天进步一点点。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-03-27 09:52:20 HTTP/2.0 GET : https://f.mffb.com.cn/a/479574.html
  2. 运行时间 : 0.100443s [ 吞吐率:9.96req/s ] 内存消耗:4,824.40kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=dff9c4589bf7e1ac6b79798616c546f7
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000574s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000831s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000311s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000258s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000470s ]
  6. SELECT * FROM `set` [ RunTime:0.000194s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000504s ]
  8. SELECT * FROM `article` WHERE `id` = 479574 LIMIT 1 [ RunTime:0.000669s ]
  9. UPDATE `article` SET `lasttime` = 1774576340 WHERE `id` = 479574 [ RunTime:0.010731s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 64 LIMIT 1 [ RunTime:0.013919s ]
  11. SELECT * FROM `article` WHERE `id` < 479574 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000555s ]
  12. SELECT * FROM `article` WHERE `id` > 479574 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000447s ]
  13. SELECT * FROM `article` WHERE `id` < 479574 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.001287s ]
  14. SELECT * FROM `article` WHERE `id` < 479574 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.000914s ]
  15. SELECT * FROM `article` WHERE `id` < 479574 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.001135s ]
0.102057s