当前位置:首页>python>Python定时任务神器:schedule库入门实战指南

Python定时任务神器:schedule库入门实战指南

  • 2026-01-22 16:28:30
Python定时任务神器:schedule库入门实战指南

在日常的Python开发中,我们经常需要让程序在特定时间执行某些任务:每天早上8点发送邮件提醒、每隔30分钟检查服务器状态、每周清理一次临时文件等等。虽然Windows有任务计划程序,Linux有cron,但作为Python开发者,我们更希望用纯Python的方式来解决这个问题。

schedule库就是为此而生的轻量级定时任务解决方案。它语法简洁、易于理解,特别适合Python初学者和中小型项目使用。本文将带你从零开始掌握schedule库,让你的Python程序拥有"时间感知"的能力。

📋 问题分析

🤔 为什么需要定时任务?

在实际的Python开发中,我们经常遇到这样的场景:

  • • 数据采集:定期爬取网站数据、API调用
  • • 系统监控:定时检查服务状态、资源使用情况
  • • 文件处理:定期清理日志、备份数据
  • • 消息推送:定时发送邮件、微信通知
  • • 上位机开发:定期读取设备数据、状态检查

💭 传统解决方案的痛点

Windows任务计划程序

  • • 配置复杂,需要通过GUI操作
  • • 难以与Python程序集成
  • • 调试困难,错误信息不直观

time.sleep()循环

import timewhileTrue:# 执行任务    do_something()    time.sleep(3600)  # 休眠1小时
  • • 不够灵活,难以实现复杂的时间规则
  • • 程序阻塞,无法处理其他逻辑
  • • 时间精度问题,容易产生累积误差

💡 解决方案:schedule库

🚀 安装与基本使用

安装命令

pip install schedule

基本语法结构

import scheduledefjob():print("任务执行中...")# 设置定时任务schedule.every(10).seconds.do(job)schedule.every().hour.do(job)schedule.every().day.at("09:00").do(job)# 保持程序运行whileTrue:    schedule.run_pending()    time.sleep(1)

🔥 三个实战案例

📝 代码实战

🕐 案例一:系统监控助手

这个例子展示如何定期监控系统资源使用情况:

import scheduleimport timeimport psutilfrom datetime import datetimedefsystem_monitor():"""系统资源监控函数"""    now = datetime.now().strftime("%Y-%m-%d %H:%M:%S")# 获取CPU和内存使用率    cpu_percent = psutil.cpu_percent(interval=1)    memory = psutil.virtual_memory()    memory_percent = memory.percent# 获取磁盘使用情况    disk = psutil.disk_usage('C:/')    disk_percent = (disk.used / disk.total) * 100print(f"[{now}] 系统监控报告:")print(f"  CPU使用率: {cpu_percent}%")print(f"  内存使用率: {memory_percent}%")print(f"  磁盘使用率: {disk_percent:.1f}%")# 预警机制if cpu_percent > 80:print("⚠️  警告:CPU使用率过高!")if memory_percent > 80:print("⚠️  警告:内存使用率过高!")if disk_percent > 90:print("⚠️  警告:磁盘空间不足!")print("-" * 40)defsetup_monitoring():"""设置监控任务"""# 每30秒检查一次系统状态    schedule.every(30).seconds.do(system_monitor)print("🚀 系统监控已启动...")print("按 Ctrl+C 停止监控")try:whileTrue:            schedule.run_pending()            time.sleep(1)except KeyboardInterrupt:print("\n📴 系统监控已停止")if __name__ == "__main__":    setup_monitoring()

实用技巧

  • • 使用psutil库获取系统信息,需要先安装:pip install psutil
  • • 添加预警机制,当资源使用率超过阈值时发出警告
  • • 使用异常处理优雅地停止程序

📊 案例二:数据采集器

这个例子展示如何定期采集股票价格数据:

import scheduleimport timeimport requestsfrom datetime import datetimeimport csvimport osclassStockDataCollector:def__init__(self, symbols):self.symbols = symbolsself.data_file = "stock_data.csv"self.init_csv_file()definit_csv_file(self):"""初始化CSV文件"""ifnot os.path.exists(self.data_file):withopen(self.data_file, 'w', newline='', encoding='utf-8'as file:                writer = csv.writer(file)                writer.writerow(['时间''股票代码''当前价格''涨跌幅'])defget_stock_price(self, symbol):"""获取股票价格(模拟数据)"""# 这里使用模拟数据,实际项目中可以调用真实的股票APIimport random        base_price = {"AAPL"150"GOOGL"2800"MSFT"300}        current_price = base_price.get(symbol, 100) * (1 + random.uniform(-0.050.05))        change_percent = random.uniform(-55)return current_price, change_percentdefcollect_data(self):"""采集股票数据"""        timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")print(f"📈 [{timestamp}] 开始采集股票数据...")for symbol inself.symbols:try:                price, change = self.get_stock_price(symbol)# 保存数据到CSVwithopen(self.data_file, 'a', newline='', encoding='utf-8'as file:                    writer = csv.writer(file)                    writer.writerow([timestamp, symbol, f"{price:.2f}"f"{change:.2f}%"])print(f"  {symbol}: ${price:.2f} ({change:+.2f}%)")except Exception as e:print(f"❌ 采集 {symbol} 数据失败: {e}")print("✅ 数据采集完成\n")defstart_collecting(self):"""启动数据采集"""# 工作日每5分钟采集一次(9:30-15:30)        schedule.every(5).minutes.do(self.collect_data)# 可以添加更复杂的时间规则# schedule.every().monday.at("09:30").do(self.collect_data)print("📊 股票数据采集器已启动...")print(f"📁 数据保存至: {self.data_file}")print("按 Ctrl+C 停止采集")try:whileTrue:                schedule.run_pending()                time.sleep(1)except KeyboardInterrupt:print("\n🛑 数据采集已停止")if __name__ == "__main__":# 要监控的股票代码    stocks = ["AAPL""GOOGL""MSFT"]    collector = StockDataCollector(stocks)    collector.start_collecting()

核心特点

  • • 面向对象设计:便于扩展和维护
  • • 数据持久化:使用CSV文件保存采集的数据
  • • 异常处理:确保单个股票采集失败不影响整体流程
  • • 模块化:数据采集逻辑与调度逻辑分离

🧹 案例三:文件清理管家

这个例子展示如何定期清理临时文件和日志文件:

import scheduleimport timeimport osimport shutilfrom datetime import datetime, timedeltafrom pathlib import PathclassFileCleanupManager:def__init__(self, config):self.config = configself.log_file = "cleanup_log.txt"deflog_message(self, message):"""记录日志"""        timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")        log_entry = f"[{timestamp}{message}\n"withopen(self.log_file, 'a', encoding='utf-8'as f:            f.write(log_entry)print(f"🧹 {log_entry.strip()}")defclean_old_files(self, directory, days_old, file_pattern="*"):"""清理指定天数前的文件"""        cleanup_count = 0        total_size = 0        cutoff_date = datetime.now() - timedelta(days=days_old)try:            directory_path = Path(directory)ifnot directory_path.exists():self.log_message(f"目录不存在: {directory}")returnfor file_path in directory_path.glob(file_pattern):if file_path.is_file():# 检查文件修改时间                    file_time = datetime.fromtimestamp(file_path.stat().st_mtime)if file_time < cutoff_date:try:                            file_size = file_path.stat().st_size                            file_path.unlink()  # 删除文件                            cleanup_count += 1                            total_size += file_sizeexcept Exception as e:self.log_message(f"删除文件失败 {file_path}{e}")if cleanup_count > 0:                size_mb = total_size / (1024 * 1024)self.log_message(f"清理完成 - {directory}: 删除 {cleanup_count} 个文件,释放 {size_mb:.2f} MB")else:self.log_message(f"无需清理 - {directory}: 没有找到过期文件")except Exception as e:self.log_message(f"清理目录失败 {directory}{e}")defclean_empty_directories(self, directory):"""清理空目录"""try:            directory_path = Path(directory)            removed_count = 0# 从最深层开始检查for dir_path insorted(directory_path.rglob('*'), key=lambda p: len(p.parts), reverse=True):if dir_path.is_dir() and dir_path != directory_path:try:ifnotany(dir_path.iterdir()):  # 检查目录是否为空                            dir_path.rmdir()                            removed_count += 1except Exception:pass# 目录不为空或删除失败,继续下一个if removed_count > 0:self.log_message(f"删除空目录: {removed_count} 个")except Exception as e:self.log_message(f"清理空目录失败: {e}")defdaily_cleanup(self):"""每日清理任务"""self.log_message("========== 开始每日清理任务 ==========")for task inself.config['daily_tasks']:self.clean_old_files(                directory=task['directory'],                days_old=task['days_old'],                file_pattern=task.get('pattern''*')            )self.log_message("========== 每日清理任务完成 ==========\n")defweekly_cleanup(self):"""每周清理任务"""self.log_message("========== 开始每周清理任务 ==========")# 执行每日清理self.daily_cleanup()# 清理空目录for task inself.config['daily_tasks']:self.clean_empty_directories(task['directory'])# 清理自己的日志文件(保留30天)self.clean_old_files("."30"cleanup_log*.txt")self.log_message("========== 每周清理任务完成 ==========\n")defstart_cleanup_service(self):"""启动清理服务"""# 每天凌晨2点执行清理        schedule.every().day.at("02:00").do(self.daily_cleanup)# 每周日凌晨3点执行深度清理        schedule.every().sunday.at("03:00").do(self.weekly_cleanup)self.log_message("文件清理服务已启动")print("⏰ 清理计划:")print("  • 每日 02:00 - 清理临时文件")print("  • 每周日 03:00 - 深度清理")print("按 Ctrl+C 停止服务")try:whileTrue:                schedule.run_pending()                time.sleep(60)  # 每分钟检查一次except KeyboardInterrupt:self.log_message("文件清理服务已停止")print("\n🛑 清理服务已停止")if __name__ == "__main__":# 清理配置    cleanup_config = {'daily_tasks': [            {'directory''C:/Temp','days_old'7,'pattern''*'            },            {'directory''./logs','days_old'30,'pattern''*.log'            },            {'directory''./cache','days_old'3,'pattern''*.tmp'            }        ]    }# 启动清理管家    cleaner = FileCleanupManager(cleanup_config)# 可以立即执行一次测试print("🧪 执行测试清理...")    cleaner.daily_cleanup()# 启动定时服务    cleaner.start_cleanup_service()

高级特性

  • • 配置驱动:通过配置字典控制清理规则
  • • 分级清理:日常清理和周度深度清理
  • • 安全机制:详细日志记录,异常处理
  • • 智能检测:根据文件修改时间判断是否需要清理

🎯 核心要点总结

通过本文的学习,你已经掌握了schedule库的核心用法和实战技巧。让我们回顾三个关键点:

1. 语法简洁直观:schedule库采用链式调用的方式,schedule.every(10).seconds.do(job)这样的语法几乎就是自然语言的表达,极大降低了学习成本,特别适合Python初学者快速上手。

2. 功能强大实用:从简单的定时执行到复杂的系统监控、数据采集、文件管理,schedule库都能胜任。配合Python的丰富生态,可以构建出功能完整的自动化解决方案,这正是Python开发的魅力所在。

3. 扩展性优秀:通过面向对象设计、异常处理、多线程等编程技巧,可以将schedule库打造成企业级的任务调度系统。在上位机开发等工业应用中,这种可靠性和扩展性尤为重要。

掌握了schedule库,你的Python程序将拥有"时间感知"的能力,无论是日常开发还是工业自动化项目,都能游刃有余。继续探索Python的更多可能性,让编程成为你解决实际问题的得力助手!

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-09 09:00:49 HTTP/2.0 GET : https://f.mffb.com.cn/a/460229.html
  2. 运行时间 : 0.134266s [ 吞吐率:7.45req/s ] 内存消耗:4,707.03kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=ff9912c12161b1d891f8c5f03af852de
  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.000489s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000667s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.001268s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.002690s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000599s ]
  6. SELECT * FROM `set` [ RunTime:0.007112s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000612s ]
  8. SELECT * FROM `article` WHERE `id` = 460229 LIMIT 1 [ RunTime:0.004118s ]
  9. UPDATE `article` SET `lasttime` = 1770598849 WHERE `id` = 460229 [ RunTime:0.003213s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000316s ]
  11. SELECT * FROM `article` WHERE `id` < 460229 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000594s ]
  12. SELECT * FROM `article` WHERE `id` > 460229 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.001377s ]
  13. SELECT * FROM `article` WHERE `id` < 460229 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.014030s ]
  14. SELECT * FROM `article` WHERE `id` < 460229 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.016175s ]
  15. SELECT * FROM `article` WHERE `id` < 460229 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.004124s ]
0.135904s