当前位置:首页>python>Modbus RTU:用Python打造工业级串口通信上位机

Modbus RTU:用Python打造工业级串口通信上位机

  • 2026-07-03 17:43:51
Modbus RTU:用Python打造工业级串口通信上位机

🔌 从一次深夜排障说起

那是个周五晚上快十点,车间里一台注塑机的温控模块突然开始报警。我盯着那台老掉牙的Windows工控机,心里清楚——问题不在硬件,在通信。

Modbus RTU。工业现场用了三十年的协议,简单、粗暴、好用。但要给它写一个像样的上位机界面?这事儿没那么轻松。

很多人第一反应是用tkinter凑合,结果界面丑得像上世纪的DOS程序;也有人直接上Qt,但Python绑定的配置能让人头疼半天。其实有个更优雅的路子——CustomTkinter + pymodbus,现代化UI加上成熟的Modbus库,组合起来既好看又好用。

这篇文章把我在几个实际项目里踩过的坑、总结出来的经验,完整地梳理一遍。代码可以直接跑,逻辑也讲清楚,不玩虚的。


🧰 环境准备与依赖安装

先把工具链理清楚。Windows环境下,建议用Python 3.10或3.11,兼容性最稳。

bash1pip install customtkinter pymodbus pyserial

三个包,各司其职:

  • ▸ customtkinter:现代化UI框架,基于tkinter但视觉效果天差地别
  • ▸ pymodbus:工业级Modbus协议栈,RTU/TCP都支持
  • ▸ pyserial:串口底层通信,pymodbus的依赖,顺手装上

装完之后验证一下:

python1import customtkinter as ctk2import pymodbus3print(ctk.__version__, pymodbus.__version__)

没报错就行。


🏗️ 整体架构设计

写工控上位机,最忌讳把所有逻辑塞进一个文件。我见过那种三千行的"超级脚本",改一个参数要找半小时——这是在给自己埋雷。

咱们这次采用三层分离的思路:

1project/2├── main.py              # 程序入口3├── modbus_client.py     # 通信层:只管收发数据4├── data_model.py        # 数据层:状态管理和数据转换5└── ui_app.py            # 视图层:界面渲染和用户交互

通信层不知道界面长什么样,界面层不关心字节怎么拼。这种解耦在后期维护时价值巨大——相信我,设备型号一换,你只需要改通信层。


📡 通信层:Modbus RTU客户端封装

这是整个程序的核心。pymodbus的API设计得比较底层,直接用有点啰嗦,封装一下更顺手。

python1# modbus_client.py2import threading3import time4from pymodbus.client import ModbusSerialClient5from pymodbus.exceptions import ModbusException678class ModbusRTUClient:9"""10    Modbus RTU 通信客户端封装11    线程安全,支持自动重连12    """13def __init__(self, port: str, baudrate: int = 9600,14                 bytesize: int = 8, parity: str = 'N',15                 stopbits: int = 1, timeout: float = 1.0):16        self._port = port17        self._baudrate = baudrate18        self._timeout = timeout19        self._lock = threading.Lock()  # 关键:串口访问必须加锁20        self._connected = False2122        self._client = ModbusSerialClient(23            port=port,24            baudrate=baudrate,25            bytesize=bytesize,26            parity=parity,27            stopbits=stopbits,28            timeout=timeout29        )3031def connect(self) -> bool:32"""建立连接,返回是否成功"""33try:34            result = self._client.connect()35            self._connected = result36return result37except Exception as e:38print(f"[Modbus] 连接失败: {e}")39            self._connected = False40return False41def disconnect(self):42"""断开连接"""43if self._client:44            self._client.close()45        self._connected = False4647@property48def is_connected(self) -> bool:49return self._connected5051def read_holding_registers(self, slave_id: int,52                                address: int, count: int) -> list | None:53"""54        读取保持寄存器(功能码 0x03)55        返回寄存器值列表,失败返回 None        """56with self._lock:57try:58                response = self._client.read_holding_registers(59                    address=address,60                    count=count,61                    device_id=slave_id62                )63if response.isError():64print(f"[Modbus] 读取错误: {response}")65return None66return response.registers67except ModbusException as e:68print(f"[Modbus] 协议异常: {e}")69                self._connected = False70return None            except Exception as e:71print(f"[Modbus] 未知错误: {e}")72return None7374def write_single_register(self, slave_id: int,75                               address: int, value: int) -> bool:76"""77        写单个保持寄存器(功能码 0x06)78        返回是否写入成功79        """        with self._lock:80try:81                response = self._client.write_register(82                    address=address,83                    value=value,84                    device_id=slave_id85                )86return not response.isError()87except Exception as e:88print(f"[Modbus] 写入失败: {e}")89return False9091def read_coils(self, slave_id: int,92                   address: int, count: int) -> list | None:93"""读取线圈状态(功能码 0x01)"""94with self._lock:95try:96                response = self._client.read_coils(97                    address=address,98                    count=count,99                    device_id=slave_id100                )101if response.isError():102return None103return response.bits[:count]104except Exception as e:105print(f"[Modbus] 线圈读取失败: {e}")106return None

有几个细节值得说一下。threading.Lock()是必须的——如果UI线程和轮询线程同时操作串口,数据会乱掉,这个Bug极难复现,但一旦出现就是灾难性的。另外,response.isError()这个判断很多人忘写,导致把错误响应当正常数据处理,然后困惑为什么数值不对。


🖥️ 界面层:CustomTkinter UI构建

CustomTkinter的优势在于它自带深色/浅色主题切换,而且控件风格比原生tkinter现代得多。工控软件通常跑在工厂环境里,深色主题对操作人员眼睛更友好。

python1# ui_app.py2import customtkinter as ctk3import threading4import time5from modbus_client import ModbusRTUClient67# 全局主题设置8ctk.set_appearance_mode("dark")9ctk.set_default_color_theme("blue")101112class ModbusApp(ctk.CTk):13"""主应用窗口"""1415def __init__(self):16super().__init__()1718        self.title("Modbus RTU 监控工具")19        self.geometry("900x650")20        self.resizable(TrueTrue)2122        self._client: ModbusRTUClient | None = None23        self._polling = False24        self._poll_thread: threading.Thread | None = None2526        self._build_ui()2728def _build_ui(self):29"""构建整体布局"""30# 顶部连接配置栏31        self._build_connection_frame()32# 中部数据展示区33        self._build_data_frame()34# 底部写入控制区35        self._build_write_frame()36# 状态栏37        self._build_status_bar()3839def _build_connection_frame(self):40"""连接参数配置区域"""41        frame = ctk.CTkFrame(self)42        frame.pack(fill="x", padx=15, pady=(155))4344        ctk.CTkLabel(frame, text="串口配置",45                     font=ctk.CTkFont(size=14, weight="bold")).pack(46            anchor="w", padx=10, pady=(84))4748        params_frame = ctk.CTkFrame(frame, fg_color="transparent")49        params_frame.pack(fill="x", padx=10, pady=(010))5051# 串口号52        ctk.CTkLabel(params_frame, text="串口:").grid(53            row=0, column=0, padx=(05), pady=5)54        self.port_var = ctk.StringVar(value="COM3")55        ctk.CTkEntry(params_frame, textvariable=self.port_var,56                     width=80).grid(row=0, column=1, padx=5)5758# 波特率59        ctk.CTkLabel(params_frame, text="波特率:").grid(60            row=0, column=2, padx=(155))61        self.baud_var = ctk.StringVar(value="9600")62        ctk.CTkOptionMenu(params_frame,63                          values=["1200""2400""4800",64"9600""19200""38400""115200"],65                          variable=self.baud_var,66                          width=100).grid(row=0, column=3, padx=5)6768# 从站ID69        ctk.CTkLabel(params_frame, text="从站ID:").grid(70            row=0, column=4, padx=(155))71        self.slave_var = ctk.StringVar(value="1")72        ctk.CTkEntry(params_frame, textvariable=self.slave_var,73                     width=60).grid(row=0, column=5, padx=5)7475# 连接/断开按钮76        self.connect_btn = ctk.CTkButton(77            params_frame, text="连接",78            width=80, command=self._toggle_connection)79        self.connect_btn.grid(row=0, column=6, padx=(205))8081# 轮询开关82        self.poll_btn = ctk.CTkButton(83            params_frame, text="开始轮询",84            width=90, state="disabled",85            command=self._toggle_polling)86        self.poll_btn.grid(row=0, column=7, padx=5)8788def _build_data_frame(self):89"""数据展示区域"""90        frame = ctk.CTkFrame(self)91        frame.pack(fill="both", expand=True, padx=15, pady=5)9293        ctk.CTkLabel(frame, text="寄存器数据",94                     font=ctk.CTkFont(size=14, weight="bold")).pack(95            anchor="w", padx=10, pady=(84))9697# 读取配置行98        read_cfg = ctk.CTkFrame(frame, fg_color="transparent")99        read_cfg.pack(fill="x", padx=10)100101        ctk.CTkLabel(read_cfg, text="起始地址:").pack(side="left")102        self.read_addr_var = ctk.StringVar(value="0")103        ctk.CTkEntry(read_cfg, textvariable=self.read_addr_var,104                     width=70).pack(side="left", padx=5)105106        ctk.CTkLabel(read_cfg, text="读取数量:").pack(side="left", padx=(100))107        self.read_count_var = ctk.StringVar(value="10")108        ctk.CTkEntry(read_cfg, textvariable=self.read_count_var,109                     width=70).pack(side="left", padx=5)110111        ctk.CTkLabel(read_cfg, text="轮询间隔(ms):").pack(112            side="left", padx=(100))113        self.interval_var = ctk.StringVar(value="500")114        ctk.CTkEntry(read_cfg, textvariable=self.interval_var,115                     width=70).pack(side="left", padx=5)116117# 数据显示文本框118        self.data_text = ctk.CTkTextbox(frame, height=280,119                                         font=ctk.CTkFont(120                                             family="Consolas", size=12))121        self.data_text.pack(fill="both", expand=True,122                             padx=10, pady=(810))123        self.data_text.insert("end""等待连接...\n")124125def _build_write_frame(self):126"""写寄存器控制区域"""127        frame = ctk.CTkFrame(self)128        frame.pack(fill="x", padx=15, pady=5)129130        ctk.CTkLabel(frame, text="写寄存器",131                     font=ctk.CTkFont(size=14, weight="bold")).pack(132            anchor="w", padx=10, pady=(84))133134        write_row = ctk.CTkFrame(frame, fg_color="transparent")135        write_row.pack(fill="x", padx=10, pady=(010))136137        ctk.CTkLabel(write_row, text="地址:").pack(side="left")138        self.write_addr_var = ctk.StringVar(value="0")139        ctk.CTkEntry(write_row, textvariable=self.write_addr_var,140                     width=70).pack(side="left", padx=5)141142        ctk.CTkLabel(write_row, text="数值:").pack(side="left", padx=(100))143        self.write_val_var = ctk.StringVar(value="0")144        ctk.CTkEntry(write_row, textvariable=self.write_val_var,145                     width=100).pack(side="left", padx=5)146147        self.write_btn = ctk.CTkButton(148            write_row, text="写入", width=80,149            state="disabled", command=self._do_write)150        self.write_btn.pack(side="left", padx=(150))151152def _build_status_bar(self):153"""底部状态栏"""154        self.status_var = ctk.StringVar(value="未连接")155        status_bar = ctk.CTkLabel(self, textvariable=self.status_var,156                                   anchor="w",157                                   font=ctk.CTkFont(size=11))158        status_bar.pack(fill="x", padx=15, pady=(28))159160# ── 业务逻辑方法 ──────────────────────────────────────161162def _toggle_connection(self):163if self._client and self._client.is_connected:164            self._stop_polling()165            self._client.disconnect()166            self._client = None167            self.connect_btn.configure(text="连接")168            self.poll_btn.configure(state="disabled")169            self.write_btn.configure(state="disabled")170            self._set_status("已断开连接")171else:172            port = self.port_var.get().strip()173            baud = int(self.baud_var.get())174            self._client = ModbusRTUClient(port=port, baudrate=baud)175if self._client.connect():176                self.connect_btn.configure(text="断开")177                self.poll_btn.configure(state="normal")178                self.write_btn.configure(state="normal")179                self._set_status(f"已连接 {port} @ {baud}bps")180else:181                self._client = None182                self._set_status(f"连接失败,请检查串口 {port} 是否可用")183184def _toggle_polling(self):185if self._polling:186            self._stop_polling()187else:188            self._start_polling()189190def _start_polling(self):191        self._polling = True192        self.poll_btn.configure(text="停止轮询")193        self._poll_thread = threading.Thread(194            target=self._poll_loop, daemon=True)195        self._poll_thread.start()196197def _stop_polling(self):198        self._polling = False199        self.poll_btn.configure(text="开始轮询")200201def _poll_loop(self):202"""轮询线程:定期读取寄存器数据"""203while self._polling and self._client:204try:205                addr = int(self.read_addr_var.get())206                count = int(self.read_count_var.get())207                interval = int(self.interval_var.get()) / 1000.0208                slave = int(self.slave_var.get())209except ValueError:210                time.sleep(0.5)211continue212213            regs = self._client.read_holding_registers(slave, addr, count)214215# 注意:tkinter控件只能在主线程操作,用after()调度216if regs is not None:217                self.after(0, self._update_display, addr, regs)218else:219                self.after(0, self._set_status, "读取失败,设备无响应")220221            time.sleep(interval)222223def _update_display(self, start_addr: int, regs: list):224"""更新数据显示(在主线程执行)"""225import datetime226        ts = datetime.datetime.now().strftime("%H:%M:%S.%f")[:-3]227228        lines = [f"[{ts}] 读取成功,起始地址 {start_addr}:"]229for i, val in enumerate(regs):230            addr = start_addr + i231            lines.append(f"  [{addr:>5}]  DEC: {val:>6}  "232f"HEX: 0x{val:04X}  BIN: {val:08b}")233        lines.append("")234235        self.data_text.insert("end""\n".join(lines) + "\n")236        self.data_text.see("end")  # 自动滚动到底部237238# 防止文本框内容无限增长,超过500行就清一次239        line_count = int(self.data_text.index("end-1c").split(".")[0])240if line_count > 500:241            self.data_text.delete("1.0""100.0")242243def _do_write(self):244"""执行寄存器写入"""245if not self._client:246return247try:248            addr = int(self.write_addr_var.get())249            val = int(self.write_val_var.get())250            slave = int(self.slave_var.get())251except ValueError:252            self._set_status("写入参数格式错误")253return254255if not (0 <= val <= 65535):256            self._set_status("寄存器值必须在 0 ~ 65535 范围内")257return258259        success = self._client.write_single_register(slave, addr, val)260if success:261            self._set_status(f"写入成功:地址 {addr} = {val}")262else:263            self._set_status(f"写入失败:地址 {addr}")264265def _set_status(self, msg: str):266        self.status_var.set(f"状态: {msg}")267268def on_closing(self):269"""窗口关闭时的清理工作"""270        self._stop_polling()271if self._client:272            self._client.disconnect()273        self.destroy()

🚀 程序入口

python1# main.py2from ui_app import ModbusApp345def main():6    app = ModbusApp()7    app.protocol("WM_DELETE_WINDOW", app.on_closing)8    app.mainloop()91011if __name__ == "__main__":12main()

就这么简单。WM_DELETE_WINDOW这个钩子一定要挂上,不然用户直接关窗口,轮询线程和串口连接不会被正确清理,偶发的资源泄漏就是这么来的。


⚠️ 常见坑位与解决方案

坑一:串口被占用。Windows下如果设备管理器里串口号对了但就是连不上,先检查有没有其他程序(比如另一个终端软件)占着那个COM口。pymodbus连接失败时报错信息不够直观,这种情况容易被误判为代码问题。

坑二:tkinter跨线程操作。这是新手最容易踩的雷。绝对不能在子线程里直接操作任何tkinter控件,必须用self.after(0, callback)把操作调度回主线程。上面代码里_update_display_set_status都是通过after()调用的,这个模式要记牢。

坑三:寄存器地址偏移。Modbus协议里地址有"协议地址"和"寄存器编号"两种表达方式,有些设备手册写的是从1开始的编号,但pymodbus的地址参数是从0开始的。如果读出来的数据对不上,先把地址减1试试。

坑四:波特率和校验位不匹配。RTU通信对串口参数极其敏感,波特率、数据位、停止位、奇偶校验必须和设备完全一致,任何一个不对都是无响应。没有设备手册的时候,9600-8-N-1是最常见的默认配置,先试这个。


💡 进阶扩展方向

这套框架搭好之后,扩展起来很顺畅。几个实用方向:

数据持久化:把轮询到的数据写入SQLite,配合matplotlib就能画出实时曲线,做趋势分析。

报警逻辑:在_update_display里加阈值判断,超限时用winsound模块触发声音报警,或者调用邮件/短信API推送通知。

多设备管理:把ModbusRTUClient改成支持多个串口实例,UI上加一个设备列表,切换不同从站地址——这就是一个完整的多点监控系统雏形了。

配置文件持久化:用configparser把串口参数、从站ID这些配置保存到ini文件,下次启动自动加载,省去重复填写的麻烦。


📝 写在最后

Modbus RTU这个协议活了这么多年,靠的是简单可靠。用Python来写上位机,生态成熟、开发快,CustomTkinter解决了"界面难看"这个老大难问题。

整个项目的核心思路就一句话:通信层、数据层、视图层各管各的,线程安全不能省,串口参数必须对。把这三点做扎实,剩下的都是功能堆叠的事儿。

源码结构清晰,可以直接在此基础上扩展,适配各种工业设备。如果在实际项目里遇到特定设备的适配问题,欢迎在评论区聊聊,说不定正好踩过同样的坑。


标签PythonCustomTkinterModbus RTU工业通信串口编程

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-04 03:11:52 HTTP/2.0 GET : https://f.mffb.com.cn/a/500338.html
  2. 运行时间 : 0.158174s [ 吞吐率:6.32req/s ] 内存消耗:4,868.01kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=e12c1b5347c35997d4008fba6795f4a2
  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.000680s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000863s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000690s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000319s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000691s ]
  6. SELECT * FROM `set` [ RunTime:0.000290s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000784s ]
  8. SELECT * FROM `article` WHERE `id` = 500338 LIMIT 1 [ RunTime:0.000607s ]
  9. UPDATE `article` SET `lasttime` = 1783105912 WHERE `id` = 500338 [ RunTime:0.016144s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000456s ]
  11. SELECT * FROM `article` WHERE `id` < 500338 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000735s ]
  12. SELECT * FROM `article` WHERE `id` > 500338 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.009810s ]
  13. SELECT * FROM `article` WHERE `id` < 500338 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.009965s ]
  14. SELECT * FROM `article` WHERE `id` < 500338 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.004217s ]
  15. SELECT * FROM `article` WHERE `id` < 500338 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.006251s ]
0.160933s