当前位置:首页>java>告别if-else手抽筋式写法:一行代码串起10个校验规则?用责任链模式把校验逻辑变成“流水线”

告别if-else手抽筋式写法:一行代码串起10个校验规则?用责任链模式把校验逻辑变成“流水线”

  • 2026-02-07 03:44:20
告别if-else手抽筋式写法:一行代码串起10个校验规则?用责任链模式把校验逻辑变成“流水线”

告别if-else手抽筋式写法:一行代码串起10个校验规则?用责任链模式把校验逻辑变成“流水线”

一、你是不是也这样写过?

publicvoidregister(String username, String email){
if (username == null || username.trim().isEmpty()) {
thrownew IllegalArgumentException("用户名不能为空");
    }
if (username.length() < 4) {
thrownew IllegalArgumentException("用户名太短");
    }
if (email == null || !email.contains("@")) {
thrownew IllegalArgumentException("邮箱格式不对");
    }
if (!email.endsWith(".com")) {
thrownew IllegalArgumentException("只支持 .com 邮箱");
    }
// ... 后面还有 10 条业务规则
}

写完自己都怕——改一条规则,心惊胆战;加一个字段,血压飙升

更惨的是,这些逻辑还散落在各个 service 里,复制粘贴成了日常操作…… 这哪是写代码?这是在“堆 if 地狱”里搬砖啊!😭

而且,一旦业务变化(比如“用户名现在允许中文了”),你得满世界找 if 语句改,稍有遗漏就埋下 bug。

可维护性?不存在的。

二、救星来了:责任链模式(Chain of Responsibility)

它是什么?

一句话:把多个处理器串成一条链,请求从头流到尾,谁该处理谁上,处理完还能决定是否继续传递。

来看看用 StringButler 怎么写:

String username = StringButler.of(input)
    .validate()
        .notBlank()
        .lengthBetween(420)
        .matches("[a-zA-Z0-9_]+")
    .transform()
        .trim()
        .toLowerCase()
    .getValueOrThrow();

PS:StringButler 是我的一个开源项目,项目地址:https://github.com/iweidujiang/string-butler

一行链式调用,搞定验证 + 转换 + 异常抛出。 而且——每加一个规则,只需多写一个方法,不用动原有逻辑

这背后的核心功臣,就是今天要聊的:责任链模式(Chain of Responsibility)

别被名字吓到,它其实就是——把一堆处理者串成一条“流水线”,数据从头流到尾,谁该干活谁上

这种模式最早由 GoF(《设计模式》四人组)提出,初衷是:“避免请求发送者与接收者耦合,让多个对象都有机会处理请求”。

翻译成人话:我不关心谁处理,我只管把任务扔进管道,能干的自己上,干不了就传下去

最适合用它的 4 种场景

场景
例子
多级审批
请假:组长 → 经理 → HR
多规则校验
注册:非空 → 长度 → 格式 → 唯一性
事件冒泡
Web 点击事件、Netty 数据包处理
中间件过滤
日志 → 鉴权 → 限流 → 业务

核心思想就一句:解耦请求发送者和接收者,让处理逻辑可插拔、可组合。

三、责任链长啥样?有图有真相

我们先看两个核心类:

  • ValidationChain:验证责任链
  • TransformationChain:转换责任链

它们内部都维护了一个 规则列表(List),比如:

// ValidationChain.java(简化版)
publicclassValidationChain{
privatefinal List<ValidationRule> rules = new ArrayList<>();
privatefinal String value;

public ValidationChain addNotBlankRule(){
        rules.add(new NotBlankRule());
returnthis;
    }

public ValidationChain addLengthRule(int min, int max){
        rules.add(new LengthRule(min, max));
returnthis;
    }

publicbooleanvalidateAll(){
for (ValidationRule rule : rules) {
if (!rule.validate(value)) {
// 一旦失败,立即中断并抛出错误信息
thrownew ValidationException(rule.getErrorMessage());
            }
        }
returntrue;
    }
}

整个流程就像工厂流水线:

优点一目了然

  • 解耦:每个规则只关心自己那点事,不知道其他规则的存在
  • 可插拔:想加就加,想删就删,像搭积木一样灵活
  • 顺序可控:先验证再转换,逻辑清晰无歧义
  • 中断机制:一旦失败,立刻停止,不浪费性能(fail-fast 原则)

更重要的是——测试变得超级简单!每个 ValidationRule 都可以独立单元测试,不需要 mock 整个上下文。

四、真实代码走一波:手写一个极简责任链(5 分钟上手)

先看最经典的“谁处理谁终止”模式:

// 1. 定义处理器基类
publicabstractclassHandler{
protected Handler next;

public Handler setNext(Handler next){
this.next = next;
return next;
    }

// 模板方法:控制流程
publicfinalvoidprocess(String user){
if (canHandle(user)) {
            handle(user);
return// 处理成功,链终止
        }
if (next != null) {
            next.process(user); // 交给下一个
        } else {
            System.out.println("无人能处理: " + user);
        }
    }

protectedabstractbooleancanHandle(String user);
protectedabstractvoidhandle(String user);
}

// 2. 实现具体处理器
classAdminHandlerextendsHandler{
@OverrideprotectedbooleancanHandle(String user){
return"admin".equals(user);
    }
@Overrideprotectedvoidhandle(String user){
        System.out.println("管理员登录成功");
    }
}

classGuestHandlerextendsHandler{
@OverrideprotectedbooleancanHandle(String user){
return"guest".equals(user);
    }
@Overrideprotectedvoidhandle(String user){
        System.out.println("访客登录成功");
    }
}

// 3. 组装 & 使用
publicclassMain{
publicstaticvoidmain(String[] args){
        Handler chain = new AdminHandler();
        chain.setNext(new GuestHandler());

        chain.process("admin");  // 管理员登录成功
        chain.process("guest");  // 访客登录成功
        chain.process("hacker"); // 无人能处理: hacker
    }
}

关键设计

  • process() 是 final,防止子类破坏流程
  • canHandle() 决定是否“认领”请求
  • 链的组装完全由外部控制,极度灵活

五、不止小工具!主流框架如何用责任链解决大问题?

责任链绝不是玩具模式,它是构建高内聚、低耦合系统的核心武器之一

来看看几个重量级选手是怎么玩的:

1. Spring Security 的认证授权

在 Spring Security 中,每个 HTTP 请求都要经过一连串的 Filter,比如:

  • UsernamePasswordAuthenticationFilter:处理表单登录
  • BearerTokenAuthenticationFilter:处理 JWT Token
  • AnonymousAuthenticationFilter:兜底匿名用户

这些 Filter 组成一条 Filter Chain,请求依次通过,只要有一个 Filter 完成认证,后续 Filter 就跳过。

核心代码示意

publicinterfaceFilter{
voiddoFilter(ServletRequest request, ServletResponse response, FilterChain chain);
}

publicclassUsernamePasswordAuthenticationFilterimplementsFilter{
@Override
publicvoiddoFilter(ServletRequest req, ServletResponse res, FilterChain chain){
if (isLoginRequest(req)) {
            authenticate(req); // 认证成功
        }
        chain.doFilter(req, res); // 交给下一个 Filter
    }
}

和 StringButler 的共通点:每个环节只做一件事,失败或成功都明确传递控制权。

2. Netty 的网络事件

Netty 的 ChannelPipeline 是责任链的教科书级实现。一个网络包进来,会依次经过:

  • ByteToMessageDecoder:字节解码
  • BusinessLogicHandler:业务处理
  • MessageToByteEncoder:结果编码

核心代码示意

publicclassChannelPipeline{
privatefinal List<ChannelHandler> handlers = new ArrayList<>();

publicvoidfireChannelRead(Object msg){
for (ChannelHandler handler : handlers) {
            msg = handler.channelRead(msg);
if (msg == nullbreak// 中断链
        }
    }
}

每个 Handler 处理完,把结果传给下一个——完全解耦,高度可插拔

3. Java Servlet:老牌但经典

最早的 Java Web 应用就用 Filter 实现日志、权限、编码统一处理:

@WebFilter("/*")
publicclassLoggingFilterimplementsFilter{
publicvoiddoFilter(ServletRequest req, ServletResponse res, FilterChain chain){
long start = System.currentTimeMillis();
        chain.doFilter(req, res); // 放行
        log.info("Request took: " + (System.currentTimeMillis() - start) + "ms");
    }
}

责任链在这里实现了“横切关注点”的集中管理——这正是 AOP(面向切面编程)的思想雏形。

总结一下: 无论是 StringButler 的字符串校验,还是 Spring 的安全控制、Netty 的网络通信,责任链的本质都是:把复杂流程拆解为独立、有序、可中断的小步骤。 小项目用它提升可读性,大系统用它保障可扩展性——一招鲜,吃遍天

六、责任链的两个常见误区

误区1:链太长影响性能?

其实不然!StringButler 的链通常只有 2~5 个规则,且失败即停(fail-fast),平均执行次数远小于 if-else 堆叠。

而且,规则对象通常是无状态的单例(或轻量实例),创建开销极小。

误区2:规则之间有依赖怎么办?

比如“必须先 trim 再验证长度”?

答案是:分阶段!

StringButler 就是这么干的:先跑完整个验证链(基于原始值),再跑转换链(生成新值),天然隔离阶段。

如果真有强依赖(比如 A 规则的结果影响 B 规则的判断),那可能就不适合用标准责任链了。这时候可以:

  • 在链中传递一个 上下文对象(Context),各环节读写共享状态
  • 或者考虑 状态模式 / 策略组合

但记住:90% 的校验/转换场景,根本不需要跨规则依赖——保持规则原子性,才是王道。

七、给你的项目提个建议

如果你的业务里有类似场景:

  • 多步骤审批(初审 → 复审 → 终审)
  • 多条件校验(格式 → 业务唯一性 → 风控)
  • 多阶段数据处理(清洗 → 转换 → 加密)

不妨试试责任链!哪怕不用 StringButler,也可以自己撸一个简易版:

@FunctionalInterface
publicinterfaceRule{
booleanapply(String input);
}

publicclassRuleChain{
privatefinal List<Rule> rules = new ArrayList<>();

public RuleChain add(Rule rule){
        rules.add(rule);
returnthis;
    }

publicvoidexecute(String input){
for (Rule rule : rules) {
if (!rule.apply(input)) {
thrownew RuntimeException("规则校验失败");
            }
        }
    }
}

// 使用
new RuleChain()
    .add(s -> s != null && !s.isEmpty())
    .add(s -> s.length() >= 4)
    .execute(username);

几行代码,告别 if 地狱,拥抱声明式编程

八、结语:好设计,是让复杂变简单

StringButler 不是一个炫技的玩具,而是一次对“如何写出可维护、可扩展、可读性强的工具代码”的认真尝试。

责任链模式,正是其中关键一环——它让验证不再是负担,而是一种声明式的表达

写代码,不是为了机器能跑,而是为了让人类(包括未来的你)能看懂、能改、敢改。

当你下次面对一堆 if-else 时,不妨问自己一句:

“这段逻辑,能不能变成一条流水线?”


本文是《StringButler设计哲学与实战》系列的第 3 篇。

如果你对这个系列感兴趣,记得关注我的博客更新哦!

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-08 04:13:34 HTTP/2.0 GET : https://f.mffb.com.cn/a/467677.html
  2. 运行时间 : 0.223936s [ 吞吐率:4.47req/s ] 内存消耗:4,488.29kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=46ea27717c6cc5c282b0d4bb3c670b9d
  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.000972s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000901s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.002828s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000286s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000584s ]
  6. SELECT * FROM `set` [ RunTime:0.009991s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001121s ]
  8. SELECT * FROM `article` WHERE `id` = 467677 LIMIT 1 [ RunTime:0.005063s ]
  9. UPDATE `article` SET `lasttime` = 1770495214 WHERE `id` = 467677 [ RunTime:0.001984s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 65 LIMIT 1 [ RunTime:0.004542s ]
  11. SELECT * FROM `article` WHERE `id` < 467677 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000606s ]
  12. SELECT * FROM `article` WHERE `id` > 467677 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.001029s ]
  13. SELECT * FROM `article` WHERE `id` < 467677 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.014829s ]
  14. SELECT * FROM `article` WHERE `id` < 467677 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.024001s ]
  15. SELECT * FROM `article` WHERE `id` < 467677 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.016214s ]
0.225665s