当前位置:首页>python>Python OOP 设计思想 16:运行期决策优先

Python OOP 设计思想 16:运行期决策优先

  • 2026-02-07 21:47:38
Python OOP 设计思想 16:运行期决策优先

前面已经探讨过:显式是一种设计责任。该被说明的边界、依赖与约束,应当被清楚地表达,而不是隐藏在默认行为或隐含假设之中。

但显式并不意味着一切都要在设计之初完全确定。

Python 的优势在于,它允许将部分决策推迟到运行期完成,以应对真实世界中的不确定性与变化。

当需求尚未稳定、对象组合尚未固定、行为需随环境调整时,过早冻结结构,往往会降低系统的可演化性。此时,延迟决策并非逃避责任,而是对变化本身的承认。

在合适的场景中,优先选择运行期决策,而非定义期承诺。

这并不是对“显式设计”的否定,而是其自然延伸:在清晰边界之内,保留必要的弹性,设计才能既稳定,又具备长期演化的空间。

16.1 编译期思维的局限

编译期思维强调在程序运行前确定一切结构,其优势在于错误早发现、行为可预测,但局限同样明显:它可能过早固化设计,限制了系统的演进能力。

说明:

这里的“编译期思维”并非特指 Python 的技术阶段,而是指在程序运行前即试图冻结全部结构的设计方式。它描述的是一种设计取向,而非具体的语言实现机制。

(1)静态类型思维下的设计限制

from typing import Unionclass Dog:    def speak(self) -> str:        return "Woof!"class Cat:    def speak(self) -> str:        return "Meow!"# 必须明确声明所有可能类型Pet = Union[Dog, Cat]    # 新增类型需要修改此处def make_pet_speak(pet: Pet) -> str:    """受限于预先声明的类型体系"""    return pet.speak()

这种设计的问题在于,在变化尚未明确的场景中,类型的扩展需要修改现有代码

每当系统中增加新的动物类型时,都需要修改 Pet 类型定义和相关的函数签名,这违反了开闭原则(对扩展开放,对修改封闭)。

(2)Python 的动态鸭子类型方案

def make_animal_speak(animal):    """基于鸭子类型:任何具有 speak 方法的对象都能工作"""    return animal.speak()# 原有类型正常工作class Bird:    def speak(self):        return "Chirp!"make_animal_speak(Bird())    # 直接工作

Python 的鸭子类型将关注点从“是什么类型”转移到“能做什么行为”。如果它走起来像鸭子,叫起来像鸭子,那么它就是鸭子,至少在当前上下文中。这种基于行为的类型系统避免了过早的类型耦合,让系统更容易演进

16.2 Python 的运行期能力

Python 的动态特性不仅仅是语言特性,更是设计工具。这些能力使得运行期操作成为可能,从而改变了我们思考软件设计的方式。

(1)运行期对象动态操作

class DynamicObject:    passobj = DynamicObject()# 运行期添加属性obj.new_attribute = "runtime value"print(obj.new_attribute)  # 输出: runtime value# 运行期修改方法def new_method(self):    return "dynamic method"DynamicObject.dynamic_method = new_methodprint(obj.dynamic_method())  # 输出: dynamic method# 运行期创建类NewClass = type('RuntimeClass', (object,), {'attr'123})instance = NewClass()print(instance.attr)    # 输出: 123

这些运行期能力使 Python 可以:

• 延迟绑定决策:不必在编写代码时确定所有细节

• 运行时适配:根据实际运行环境调整行为

• 动态扩展:在运行时添加新的功能模块

Python 的“运行期”不仅仅是程序的“执行阶段”,而是持续的设计决策阶段。设计决策可以在程序运行过程中被重新评估和调整,这使得系统能够更好地适应变化的需求和环境。

16.3 动态绑定与延迟决策

在 Python 中,名称与对象的绑定发生在运行期,这为延迟决策提供了语言层面的支持。延迟决策不是拖延,而是让事实驱动设计的智慧。

(1)运行期策略选择模式

class EmailSender:    def send(self, message):        return f"Email sent: {message}"class SMSSender:    def send(self, message):        return f"SMS sent: {message}"class PushSender:    def send(self, message):        return f"Push sent: {message}"def get_sender(channel):    """运行期选择发送方式"""    senders = {        'email': EmailSender(),        'sms': SMSSender(),        'push': PushSender()    }    return senders.get(channel, EmailSender())channel = 'sms'sender = get_sender(channel)print(sender.send("Hello!"))    # 输出: SMS sent: Hello!# 动态修改行为sender.send = lambda msg: f"Overridden: {msg}"print(sender.send("Test"))    # 输出: Overridden: Test

这种运行期行为覆盖应当局限于受控场景(如测试、调试或实验性扩展),而不宜成为核心业务路径的一部分

(2)动态绑定的设计优势

class PluginSystem:    def __init__(self):        self.plugins = {}    def load_plugin(self, name):        """运行期加载插件,失败即抛出异常"""        import importlib        module = importlib.import_module(name)        self.plugins[name] = module.Plugin()

• 延迟绑定:直到真正使用时才建立关联

• 运行时选择:基于实际条件选择实现

• 热插拔能力:运行时添加、移除或替换组件

让事实驱动设计,而不是假设驱动设计。Python 通过动态绑定,允许设计决策基于实际的运行时信息,而不是编写代码时的假设。

16.4 运行期失败的可控性

运行期决策不可避免地引入了更多失败的可能性,但 Python 将失败处理纳入了语言的核心模型。失败并非设计之外的异常情况,而是应当被纳入正常处理路径的一部分

(1)防御性设计模式

class PaymentProcessor:    def process_payment(self, method, amount):        processors = {            'credit_card'self._process_credit_card,            'paypal'self._process_paypal,            'wechat'self._process_wechat        }        if method not in processors:            raise ValueError(f"不支持的支付方式: {method}")        processor = processors[method]        try:            return processor(amount)        except ConnectionError:            return self._fallback_payment(amount)        except Exception as e:            raise PaymentError(f"支付失败: {e}"from e    def _process_credit_card(self, amount):        if amount > 10000:            raise ValueError("金额超过单笔限额")        return f"信用卡支付成功: {amount}"    def _fallback_payment(self, amount):        return f"备用支付成功: {amount}"class PaymentError(Exception):    """支付处理失败"""    pass

在 Python 中,失败不是需要避免的异常状态,而是系统必须处理的正常情况。通过将失败纳入设计考虑,我们可以创建更健壮的系统:

• 失败预期:假定任何操作都可能失败

• 优雅降级:当主要路径失败时,有备用方案

• 自适应恢复:系统能够从失败中学习和调整

设计系统时,假设一切都会失败,然后让系统在这样的假设下仍然能够工作。Python 的动态特性使得这种防御性设计模式更加自然和强大。

16.5 运行期即设计现场

在 Python 的世界观中,设计并非在代码完成时结束。每一次程序运行都是对设计假设的验证,也是设计持续演进的机会。运行期不仅是执行代码的阶段,更是设计的延伸和实践场。

(1)特性开关:运行期配置设计

class FeatureToggle:    """运行期特性开关"""    def __init__(self):        self.enabled_features = {}        self.usage_stats = {}    def is_enabled(self, feature_name):        self.usage_stats[feature_name] = self.usage_stats.get(feature_name, 0) + 1        return self.enabled_features.get(feature_name, False)    def enable_feature(self, feature_name):        self.enabled_features[feature_name] = True        print(f"已启用特性: {feature_name}")    def get_usage_report(self):        return self.usage_stats

(2)自适应算法:基于运行期数据的动态调整

class AdaptiveAlgorithm:    """根据运行期数据调整算法"""    def __init__(self):        self.strategy = self._default_strategy        self.performance_data = []    def execute(self, data):        if len(self.performance_data) > 10 and all(p > 0.5 for p in self.performance_data[-5:]):            self.strategy = self._optimized_strategy        result = self.strategy(data)        self.performance_data.append(self._measure_performance(result))        return result    def _default_strategy(self, data):        return sorted(data)    def _optimized_strategy(self, data):        return sorted(data, key=lambda x: abs(x))    def _measure_performance(self, result):        return 1.0  # 示例测量

运行期即设计现场的核心思想:

• 设计不是一次性的:设计在运行期持续演进和验证

• 数据驱动设计:基于实际运行数据做出设计决策

• 渐进式演进:通过特性开关、金丝雀发布等技术逐步引入变化

在 Python 中,我们可以构建能够感知自身运行状态并据此调整行为的系统。这种能力使得设计不再是静态的蓝图,而成为动态的、自适应的过程。

16.6 运行期决策的实际应用

在实际项目中,许多设计决策无法在编写代码时完全确定。Python 鼓励在运行期根据环境、配置和使用情况动态调整行为,从而提高系统灵活性和可扩展性。典型场景包括插件系统、动态配置和策略选择。

(1)插件系统:动态扩展能力

import importlibclass PluginManager:    def __init__(self):        self.plugins = {}    def load_plugin(self, plugin_name):        try:            module = importlib.import_module(f"plugins.{plugin_name}")            plugin_class = getattr(module, plugin_name.title())            self.plugins[plugin_name] = plugin_class()            print(f"已加载插件: {plugin_name}")        except (ImportError, AttributeError) as e:            print(f"加载插件失败 {plugin_name}{e}")    def execute_plugin(self, plugin_name, *args, **kwargs):        if plugin_name not in self.plugins:            raise ValueError(f"插件未加载: {plugin_name}")        return self.plugins[plugin_name].execute(*args, **kwargs)

(2)配置驱动服务

import jsonclass ConfigurableService:    """根据运行期配置调整行为"""    def __init__(self, config_file):        with open(config_file) as f:            self.config = json.load(f)        if self.config.get("use_cache"False):            self.data_source = CachedDataSource()        else:            self.data_source = DirectDataSource()        self.timeout = self.config.get("timeout"30)        self.retries = self.config.get("retries"3)

说明:

上述示例中,CachedDataSource 与 DirectDataSource 表示不同的数据获取策略,在此处仅用于说明运行期根据配置选择实现。

(3)运行期决策的优势与应用场景

优势:

• 环境适应:根据实际运行环境调整行为

• 配置驱动:通过配置文件改变系统行为,无需代码变更

• 动态发现:运行时发现和加载组件

• 条件化执行:根据运行时条件选择不同的执行路径

当遇到以下情况时,考虑使用运行期决策:

• 实现策略可能因环境而异

• 需要支持插件或扩展机制

• 配置可能频繁变化

• 需要 A/B 测试或特性开关

16.7 元类与类级设计

Python 允许在运行期对类本身进行动态调整,这通过元类(metaclass)实现。元类不仅能创建类,还能在类创建时修改类的属性、方法或行为,从而实现类级别的设计控制

(1)元类的核心应用

# 简单元类示例class SingletonMeta(type):    _instances = {}    def __call__(cls, *args, **kwargs):        if cls not in cls._instances:            cls._instances[cls] = super().__call__(*args, **kwargs)        return cls._instances[cls]class Database(metaclass=SingletonMeta):    passdb1 = Database()db2 = Database()print(db1 is db2)  # True - 运行期确保单例

(2)元类的实际价值

class AutoRegisterMeta(type):    def __init__(cls, name, bases, attrs):        super().__init__(name, bases, attrs)        if not hasattr(cls, '_registry'):            cls._registry = []        cls._registry.append(cls)  # 自动注册所有子类class Plugin(metaclass=AutoRegisterMeta):    passclass EmailPlugin(Plugin): passclass SMSPlugin(Plugin): passprint(Plugin._registry)  # 包含所有自动注册的插件类

(3)元类的设计意义

• 类级别控制:影响类的创建过程,而不仅仅是实例

• 自动注册:在类定义时自动执行注册逻辑

• 接口验证:在类创建时验证接口实现

• 行为注入:为所有子类统一添加行为

(4)元类的应用场景

• 单例模式:控制类的实例化过程

• 接口注册:自动收集所有实现特定接口的类

• 属性验证:在类创建时检查属性约束

• 行为注入:为类统一添加日志、监控等横切关注点

元类是强大的工具,但应谨慎使用。在考虑元类之前,先评估是否可以通过装饰器、类装饰器或普通继承达到相同目的。

📘 小结

在 Python 中,设计并不止步于代码完成之时。借助运行期决策、动态绑定以及类级机制,系统的关键结构与行为可以在真实使用中逐步显现与调整。延迟决策并不是对设计责任的削弱,而是在清晰边界之内,为变化预留必要的空间。通过将部分承诺推迟到运行期,设计得以在不确定的环境中保持稳定,并持续演化。在 Python 的语境下,运行期不仅是执行阶段,更是设计被检验、修正与深化的现场

点赞有美意,赞赏是鼓励

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-08 14:14:42 HTTP/2.0 GET : https://f.mffb.com.cn/a/464073.html
  2. 运行时间 : 0.525616s [ 吞吐率:1.90req/s ] 内存消耗:4,944.80kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=e4986bec47fafe5f70d4b7fe2f3d8250
  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.000678s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000937s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.100790s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.100813s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000875s ]
  6. SELECT * FROM `set` [ RunTime:0.072057s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000913s ]
  8. SELECT * FROM `article` WHERE `id` = 464073 LIMIT 1 [ RunTime:0.017629s ]
  9. UPDATE `article` SET `lasttime` = 1770531282 WHERE `id` = 464073 [ RunTime:0.014100s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.008108s ]
  11. SELECT * FROM `article` WHERE `id` < 464073 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.035628s ]
  12. SELECT * FROM `article` WHERE `id` > 464073 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.010427s ]
  13. SELECT * FROM `article` WHERE `id` < 464073 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.053208s ]
  14. SELECT * FROM `article` WHERE `id` < 464073 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.034674s ]
  15. SELECT * FROM `article` WHERE `id` < 464073 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.005057s ]
0.527115s