当前位置:首页>python>Python Tkinter插件系统设计:让你的桌面应用具备无限扩展能力

Python Tkinter插件系统设计:让你的桌面应用具备无限扩展能力

  • 2026-03-26 09:16:24
Python Tkinter插件系统设计:让你的桌面应用具备无限扩展能力

🤔 你有没有遇到过这种情况?

项目上线三个月,客户突然说:"能不能加个导出Excel的功能?"

又过了两个月:"我们还需要一个自动备份模块。"

再过一个月:"能不能把报表功能单独给另一个团队用?"

每次改需求,你都要深入主程序的代码堆里翻来翻去,改完这里断那里,测试一遍又一遍。说实话,这种感觉不像在写代码,更像是在拆炸弹——不知道哪根线碰不得。

问题的根源不是需求多,而是架构没有给扩展留好门

今天咱们聊的就是这个:用Tkinter构建一套真正可扩展的插件系统。不是那种"伪插件"——把几个模块import进来就叫插件。而是动态加载、热插拔、主程序完全不感知具体插件内容的那种。


🧩 插件系统的本质是什么?

在动手写代码之前,先把概念捋清楚。很多人一听"插件系统"就觉得很玄,其实本质上就三件事:

  1. 1. 约定接口:主程序和插件之间有一份"契约",规定插件长什么样
  2. 2. 动态发现:主程序运行时自动找到插件,不需要硬编码
  3. 3. 解耦隔离:插件的增删不影响主程序,主程序也不依赖具体插件

打个比方——USB接口。你的电脑不知道你会插什么设备,但只要设备符合USB协议,就能用。插件系统的设计思路完全一样。


🏗️ 整体架构设计

咱们要做的系统包含四个核心部件:

主程序 (main_app.py)├── 插件管理器 (plugin_manager.py)   ← 负责发现和加载├── 插件基类 (plugin_base.py)        ← 定义"契约"├── plugins/                          ← 插件目录│   ├── plugin_hello.py│   ├── plugin_calculator.py│   └── plugin_export.py└── plugin_config.json               ← 插件配置(可选)

这个结构的好处是:你要新增一个功能,只需要在plugins/目录下丢一个新文件,主程序下次启动就自动识别了。删除功能?把文件移走就行。主程序代码一行都不用动。


📐 第一步:定义插件契约(基类)

这是整个系统最关键的部分。基类定义得好不好,直接决定插件系统的灵活性。

from abc import ABC, abstractmethodimport tkinter as tkfrom tkinter import ttkclassPluginBase(ABC):"""    插件基类 —— 所有插件必须继承此类    这就是咱们的"USB协议"    """# 插件元信息,子类必须覆盖这些    name: str = "未命名插件"    version: str = "1.0.0"    description: str = "暂无描述"    author: str = "匿名"def__init__(self, app_context: dict):"""        app_context: 主程序传入的上下文,包含共享资源        比如数据库连接、配置信息、主窗口引用等        """self.ctx = app_contextself.is_active = False    @abstractmethoddefactivate(self, parent_frame: tk.Frame) -> None:"""        插件激活时调用,在此创建UI并绑定逻辑        parent_frame: 主程序分配给插件的容器        """pass    @abstractmethoddefdeactivate(self) -> None:"""        插件停用时调用,负责清理资源        """passdefget_menu_items(self) -> list:"""        返回插件希望注册到菜单栏的条目        格式: [{"label": "功能名", "command": callback}, ...]        默认返回空列表,插件可选择性覆盖        """return []defon_app_close(self) -> None:"""        主程序关闭时的钩子,插件可在此保存状态        """pass

注意这里用了ABC抽象基类。activatedeactivate是必须实现的,其他方法提供了默认实现——这叫最小强制约束。插件开发者不需要实现一堆没用的方法,降低了接入成本。


🔍 第二步:插件管理器(核心引擎)

插件管理器负责三件事:扫描目录、动态加载模块、管理插件生命周期。

import osimport importlibimport importlib.utilimport loggingfrom typing importDictTypefrom plugin_base import PluginBaselogger = logging.getLogger(__name__)classPluginManager:def__init__(self, plugin_dir: str, app_context: dict):self.plugin_dir = plugin_dirself.app_context = app_context# 已发现的插件类 {plugin_name: PluginClass}self._registry: Dict[strType[PluginBase]] = {}# 已实例化的插件 {plugin_name: plugin_instance}self._instances: Dict[str, PluginBase] = {}defdiscover(self) -> list:"""        扫描插件目录,发现所有合法插件        返回发现的插件名称列表        """        discovered = []ifnot os.path.exists(self.plugin_dir):            logger.warning(f"插件目录不存在: {self.plugin_dir}")return discoveredfor filename in os.listdir(self.plugin_dir):# 只处理 plugin_ 开头的 .py 文件,避免误加载ifnot (filename.startswith("plugin_"and filename.endswith(".py")):continue            module_name = filename[:-3]  # 去掉 .py            filepath = os.path.join(self.plugin_dir, filename)try:                plugin_class = self._load_plugin_class(module_name, filepath)if plugin_class:self._registry[plugin_class.name] = plugin_class                    discovered.append(plugin_class.name)                    logger.info(f"发现插件: {plugin_class.name} v{plugin_class.version}")except Exception as e:                logger.error(f"加载插件失败 [{filename}]: {e}")# 单个插件失败不影响其他插件,继续扫描continuereturn discovereddef_load_plugin_class(self, module_name: str, filepath: str):"""        从文件动态加载插件类        这里用了 importlib.util,比直接 import 更灵活        """        spec = importlib.util.spec_from_file_location(module_name, filepath)        module = importlib.util.module_from_spec(spec)        spec.loader.exec_module(module)# 在模块中寻找 PluginBase 的子类for attr_name indir(module):            attr = getattr(module, attr_name)try:if (isinstance(attr, type)andissubclass(attr, PluginBase)and attr isnot PluginBase):return attrexcept TypeError:continuereturnNonedefactivate_plugin(self, plugin_name: str, parent_frame) -> bool:"""激活指定插件"""if plugin_name notinself._registry:            logger.error(f"插件未注册: {plugin_name}")returnFalseif plugin_name inself._instances:            logger.warning(f"插件已激活: {plugin_name}")returnTruetry:            plugin_class = self._registry[plugin_name]            instance = plugin_class(self.app_context)            instance.activate(parent_frame)            instance.is_active = Trueself._instances[plugin_name] = instancereturnTrueexcept Exception as e:            logger.error(f"激活插件失败 [{plugin_name}]: {e}")returnFalsedefdeactivate_plugin(self, plugin_name: str) -> bool:"""停用指定插件"""if plugin_name notinself._instances:returnFalsetry:            instance = self._instances[plugin_name]            instance.deactivate()            instance.is_active = Falsedelself._instances[plugin_name]returnTrueexcept Exception as e:            logger.error(f"停用插件失败 [{plugin_name}]: {e}")returnFalsedefget_all_menu_items(self) -> list:"""收集所有激活插件的菜单条目"""        items = []for instance inself._instances.values():            items.extend(instance.get_menu_items())return itemsdefshutdown_all(self):"""主程序关闭时,通知所有插件"""for name, instance inlist(self._instances.items()):try:                instance.on_app_close()                instance.deactivate()except Exception as e:                logger.error(f"插件关闭异常 [{name}]: {e}")    @propertydefavailable_plugins(self) -> list:returnlist(self._registry.keys())    @propertydefactive_plugins(self) -> list:returnlist(self._instances.keys())

这段代码有个细节值得说一下:_load_plugin_class里用了importlib.util.spec_from_file_location而不是直接import。原因是插件文件不在Python的标准搜索路径里,用spec方式可以从任意路径加载,这是实现"插件放哪里都能用"的关键。


🔌 第三步:写两个真实的插件

光有框架不够,咱们来写两个有实际功能的插件,感受一下接入有多简单。

插件一:计算器插件

import tkinter as tkfrom tkinter import ttkimport sys, ossys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))from plugin_base import PluginBaseclassCalculatorPlugin(PluginBase):    name = "简易计算器"    version = "1.0.0"    description = "提供基础四则运算功能"    author = "示例作者"defactivate(self, parent_frame: tk.Frame) -> None:self.frame = ttk.LabelFrame(parent_frame, text="计算器", padding=10)self.frame.pack(fill=tk.BOTH, expand=True, padx=5, pady=5)self.expr_var = tk.StringVar()        entry = ttk.Entry(self.frame, textvariable=self.expr_var, font=("Consolas"14))        entry.pack(fill=tk.X, pady=(08))self.result_var = tk.StringVar(value="结果将显示在这里")        ttk.Label(self.frame, textvariable=self.result_var,                  font=("微软雅黑"12), foreground="#2196F3").pack()        ttk.Button(self.frame, text="计算", command=self._calculate).pack(pady=8)def_calculate(self):        expr = self.expr_var.get().strip()try:# 用 eval 计算,生产环境建议换成安全的解析器            result = eval(expr, {"__builtins__": {}})self.result_var.set(f"= {result}")except Exception:self.result_var.set("表达式有误,请检查")defdeactivate(self) -> None:ifhasattr(self"frame"):self.frame.destroy()defget_menu_items(self) -> list:return [{"label""打开计算器""command"lambdaprint("计算器已在面板中")}]

插件二:系统信息插件

import tkinter as tkfrom tkinter import ttkimport platform, psutilimport sys, ossys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))from plugin_base import PluginBaseclassSysInfoPlugin(PluginBase):    name = "系统信息"    version = "1.1.0"    description = "显示当前系统运行状态"    author = "示例作者"defactivate(self, parent_frame: tk.Frame) -> None:self.frame = ttk.LabelFrame(parent_frame, text="系统信息", padding=10)self.frame.pack(fill=tk.BOTH, expand=True, padx=5, pady=5)self.info_text = tk.Text(self.frame, height=10, font=("Consolas"10),                                  state=tk.DISABLED, bg="#1e1e1e", fg="#d4d4d4")self.info_text.pack(fill=tk.BOTH, expand=True)        ttk.Button(self.frame, text="刷新", command=self._refresh).pack(pady=5)self._refresh()def_refresh(self):        info_lines = [f"操作系统: {platform.system()}{platform.release()}",f"Python版本: {platform.python_version()}",f"CPU核心数: {psutil.cpu_count()} 核",f"CPU使用率: {psutil.cpu_percent(interval=0.5)}%",f"内存总量: {psutil.virtual_memory().total // (1024**3)} GB",f"内存使用: {psutil.virtual_memory().percent}%",f"磁盘使用: {psutil.disk_usage('/').percent}%",        ]self.info_text.config(state=tk.NORMAL)self.info_text.delete("1.0", tk.END)self.info_text.insert(tk.END, "\n".join(info_lines))self.info_text.config(state=tk.DISABLED)defdeactivate(self) -> None:ifhasattr(self"frame"):self.frame.destroy()

🖥️ 第四步:主程序集成

把插件管理器接进主程序,这部分代码量其实很少:

import tkinter as tkfrom tkinter import ttk, messageboximport loggingfrom plugin_manager import PluginManagerlogging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")classMainApp(tk.Tk):def__init__(self):super().__init__()self.title("可扩展插件系统演示")self.geometry("900x600")self.configure(bg="#f0f0f0")# 应用上下文 —— 插件可以通过 self.ctx 访问这些共享资源self.app_context = {"root"self,"config": {"theme""default""lang""zh_CN"},# 实际项目里可以放数据库连接、事件总线等        }self._build_ui()self._init_plugin_system()self.protocol("WM_DELETE_WINDOW"self._on_close)def_build_ui(self):# 顶部菜单栏self.menubar = tk.Menu(self)self.plugin_menu = tk.Menu(self.menubar, tearoff=0)self.menubar.add_cascade(label="插件", menu=self.plugin_menu)self.config(menu=self.menubar)# 左侧插件列表面板        left_panel = ttk.Frame(self, width=180)        left_panel.pack(side=tk.LEFT, fill=tk.Y, padx=(80), pady=8)        left_panel.pack_propagate(False)        ttk.Label(left_panel, text="可用插件", font=("微软雅黑"11"bold")).pack(pady=(06))self.plugin_listbox = tk.Listbox(left_panel, font=("微软雅黑"10),                                          selectmode=tk.SINGLE, activestyle="none")self.plugin_listbox.pack(fill=tk.BOTH, expand=True)        btn_frame = ttk.Frame(left_panel)        btn_frame.pack(fill=tk.X, pady=6)        ttk.Button(btn_frame, text="激活", command=self._activate_selected).pack(side=tk.LEFT, expand=True)        ttk.Button(btn_frame, text="停用", command=self._deactivate_selected).pack(side=tk.LEFT, expand=True)# 右侧插件内容区域self.content_frame = ttk.Frame(self)self.content_frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True, padx=8, pady=8)def_init_plugin_system(self):self.pm = PluginManager(plugin_dir="plugins", app_context=self.app_context)        discovered = self.pm.discover()for name in discovered:self.plugin_listbox.insert(tk.END, name)        logging.info(f"共发现 {len(discovered)} 个插件: {discovered}")def_activate_selected(self):        sel = self.plugin_listbox.curselection()ifnot sel:return        plugin_name = self.plugin_listbox.get(sel[0])ifself.pm.activate_plugin(plugin_name, self.content_frame):self._refresh_menu()def_deactivate_selected(self):        sel = self.plugin_listbox.curselection()ifnot sel:return        plugin_name = self.plugin_listbox.get(sel[0])self.pm.deactivate_plugin(plugin_name)self._refresh_menu()def_refresh_menu(self):"""根据当前激活插件刷新菜单栏"""self.plugin_menu.delete(0, tk.END)for item inself.pm.get_all_menu_items():self.plugin_menu.add_command(label=item["label"], command=item["command"])def_on_close(self):self.pm.shutdown_all()self.destroy()if __name__ == "__main__":    app = MainApp()    app.mainloop()

⚠️ 几个必须注意的坑

坑一:插件加载失败不能崩主程序。 这一点在PluginManager.discover()里已经用try/except处理了——单个插件出问题,其他插件照常跑。生产环境里建议把错误写入日志,方便排查。

坑二:eval在计算器插件里用了,但别在生产代码里这么干。 上面的示例为了简洁用了eval,但如果表达式来自用户输入,存在安全风险。真正的项目里建议用ast.literal_eval或者专门的表达式解析库。

坑三:插件间通信要通过上下文,不要直接互相引用。 如果插件A直接import插件B,那插件系统的解耦就白做了。正确做法是通过app_context里的事件总线或共享数据结构来通信。

坑四:Tkinter是单线程的。 插件里如果有耗时操作(网络请求、文件读写),必须用threadingconcurrent.futures放到后台线程,再用root.after()把结果回调到主线程更新UI。否则界面会卡死。


🚀 进一步扩展的方向

这套架构打好了地基,后续可以往几个方向延伸:

插件配置持久化:给每个插件分配独立的配置文件(plugins/config/plugin_name.json),插件自己管理自己的设置,主程序不介入。

插件依赖声明:在插件基类里加一个dependencies字段,让插件声明自己依赖哪些其他插件或Python包,管理器在加载时自动检查。

热重载支持:在开发模式下,监听插件目录的文件变化(用watchdog库),文件修改后自动重新加载对应插件,不用重启整个程序。

插件市场集成:把插件打包成zip,提供一个在线仓库,用户在应用内直接下载安装——这就是很多成熟桌面软件的插件生态雏形了。


📌 小结

今天咱们从零搭建了一套Tkinter插件系统,核心思路就三步:用抽象基类定义契约、用importlib动态加载、用上下文对象解耦通信。这套模式不只适用于Tkinter,PyQt、wx等其他GUI框架同样适用,甚至命令行工具也可以借鉴。

代码已整理为完整工程结构,可直接在Windows环境下运行。psutil需要额外安装(pip install psutil),其余均为标准库。

有问题欢迎在评论区交流,特别是关于插件间通信和热重载的实现——这两块展开来说都能再写一篇。


标签#Python#Tkinter#插件系统#桌面开发#软件架构

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-03-27 09:59:14 HTTP/2.0 GET : https://f.mffb.com.cn/a/482790.html
  2. 运行时间 : 0.196014s [ 吞吐率:5.10req/s ] 内存消耗:4,883.29kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=f983202c56a880750788c631761cbd10
  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.001748s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001641s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000752s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000866s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001257s ]
  6. SELECT * FROM `set` [ RunTime:0.000582s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001465s ]
  8. SELECT * FROM `article` WHERE `id` = 482790 LIMIT 1 [ RunTime:0.002435s ]
  9. UPDATE `article` SET `lasttime` = 1774576755 WHERE `id` = 482790 [ RunTime:0.017276s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000640s ]
  11. SELECT * FROM `article` WHERE `id` < 482790 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001141s ]
  12. SELECT * FROM `article` WHERE `id` > 482790 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.002003s ]
  13. SELECT * FROM `article` WHERE `id` < 482790 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.001977s ]
  14. SELECT * FROM `article` WHERE `id` < 482790 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.002418s ]
  15. SELECT * FROM `article` WHERE `id` < 482790 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.002355s ]
0.200059s