当前位置:首页>python>Python PDF 自动化保姆级⑥:Word/Excel 批量转 PDF,PDF 转图片

Python PDF 自动化保姆级⑥:Word/Excel 批量转 PDF,PDF 转图片

  • 2026-09-04 15:27:35
Python PDF 自动化保姆级⑥:Word/Excel 批量转 PDF,PDF 转图片

前面五篇覆盖了 PDF 的基础操作、文本提取、表格提取、加密水印和生成报告。今天进入第六个高频场景:格式转换

职场中格式转换的需求无处不在:Word 文档要转 PDF 发给客户、Excel 报表要转 PDF 打印、PDF 要转成图片插入 PPT、几十份文件要批量转换…… 一个个打开另存为,效率太低。

01 Word 转 PDF:两种方案对比

Python 将 Word 转 PDF 主要有两种方案,各有适用场景:

方案一:pywin32(Windows 专用,效果最好)

调用本机 Microsoft Word 的 COM 接口,用 Word 本身打开文档再另存为 PDF。优点是转换效果 100% 还原,格式、字体、图表都不会乱。缺点是只能在 Windows 上用,且必须安装 Microsoft Word。

方案二:libreoffice(跨平台,效果较好)

调用 LibreOffice 的命令行工具转换。优点是跨平台(Windows/Mac/Linux 都能用),不需要安装 Microsoft Office。缺点是复杂格式的还原度略低于 Word 原生转换。

02 方案一:pywin32 调用 Word 转换

先安装 pywin32:

pip install pywin32

单文件转换:

import win32com.clientimport osdef word_to_pdf(word_path, pdf_path):    # 启动Word应用    word = win32com.client.Dispatch("Word.Application")    word.Visible = False  # 后台运行,不显示界面    try:        # 打开文档        doc = word.Documents.Open(os.path.abspath(word_path))        # 另存为PDF(17是PDF格式代码)        doc.SaveAs(os.path.abspath(pdf_path), FileFormat=17)        doc.Close()        print(f"转换成功: {word_path} → {pdf_path}")    except Exception as e:        print(f"转换失败: {word_path}, 错误: {str(e)}")    finally:        word.Quit()word_to_pdf("document.docx""document.pdf")

批量转换整个文件夹:

import win32com.clientimport osdef batch_word_to_pdf(input_dir, output_dir):    os.makedirs(output_dir, exist_ok=True)    word = win32com.client.Dispatch("Word.Application")    word.Visible = False    # 获取所有Word文件    word_files = [f for f in os.listdir(input_dir)                  if f.lower().endswith((".doc"".docx"))]    success = 0    fail = 0    for filename in word_files:        input_path = os.path.join(input_dir, filename)        pdf_name = os.path.splitext(filename)[0] + ".pdf"        output_path = os.path.join(output_dir, pdf_name)        try:            doc = word.Documents.Open(os.path.abspath(input_path))            doc.SaveAs(os.path.abspath(output_path), FileFormat=17)            doc.Close()            print(f"✓ {filename} → {pdf_name}")            success += 1        except Exception as e:            print(f"✗ {filename} 失败: {str(e)}")            fail += 1    word.Quit()    print(f"\n完成!成功 {success} 个,失败 {fail} 个")batch_word_to_pdf("./word_files""./pdf_output")

关键说明:

  1. 必须用 os.path.abspath() 转换为绝对路径,Word 的 COM 接口不支持相对路径。
  2. FileFormat=17 是 PDF 格式的代码,这是 Word 的常量值。
  3. 批量转换时只启动一次 Word 实例,循环处理所有文件,最后再 Quit,比每次启动关闭快很多。

03 方案二:LibreOffice 跨平台转换

先安装 LibreOffice(官网下载免费安装),确保命令行可用。

Windows 安装后,soffice.exe 通常在C:\Program Files\LibreOffice\program\soffice.exe

单文件转换:

import subprocessimport osdef word_to_pdf_libreoffice(word_path, output_dir):    # LibreOffice可执行文件路径(根据实际安装位置调整)    soffice = "C:/Program Files/LibreOffice/program/soffice.exe"    # Mac: /Applications/LibreOffice.app/Contents/MacOS/soffice    # Linux: soffice    cmd = [        soffice,        "--headless",  # 无头模式,不显示界面        "--convert-to""pdf",        "--outdir", output_dir,        word_path    ]    result = subprocess.run(cmd, capture_output=True, text=True)    if result.returncode == 0:        print(f"转换成功: {word_path}")    else:        print(f"转换失败: {result.stderr}")word_to_pdf_libreoffice("document.docx""./pdf_output")

批量转换:

import subprocessimport osdef batch_convert_libreoffice(input_dir, output_dir):    os.makedirs(output_dir, exist_ok=True)    soffice = "C:/Program Files/LibreOffice/program/soffice.exe"    files = [f for f in os.listdir(input_dir)             if f.lower().endswith((".doc"".docx"".xls"".xlsx"))]    for filename in files:        filepath = os.path.join(input_dir, filename)        cmd = [soffice, "--headless""--convert-to""pdf",               "--outdir", output_dir, filepath]        result = subprocess.run(cmd, capture_output=True, text=True)        if result.returncode == 0:            print(f"✓ {filename}")        else:            print(f"✗ {filename}{result.stderr.strip()}")batch_convert_libreoffice("./office_files""./pdf_output")

LibreOffice 的好处是一个命令搞定 Word 和 Excel 转 PDF,不需要分开写代码。

04 Excel 转 PDF

方案一:pywin32 调用 Excel(Windows,效果最好)

import win32com.clientimport osdef excel_to_pdf(excel_path, pdf_path):    excel = win32com.client.Dispatch("Excel.Application")    excel.Visible = False    excel.DisplayAlerts = False  # 禁用弹窗提示    try:        wb = excel.Workbooks.Open(os.path.abspath(excel_path))        # 0是PDF格式        wb.ExportAsFixedFormat(0, os.path.abspath(pdf_path))        wb.Close()        print(f"转换成功: {excel_path} → {pdf_path}")    except Exception as e:        print(f"转换失败: {str(e)}")    finally:        excel.Quit()excel_to_pdf("report.xlsx""report.pdf")

批量转换:

import win32com.clientimport osdef batch_excel_to_pdf(input_dir, output_dir):    os.makedirs(output_dir, exist_ok=True)    excel = win32com.client.Dispatch("Excel.Application")    excel.Visible = False    excel.DisplayAlerts = False    excel_files = [f for f in os.listdir(input_dir)                   if f.lower().endswith((".xls"".xlsx"))]    for filename in excel_files:        input_path = os.path.join(input_dir, filename)        pdf_name = os.path.splitext(filename)[0] + ".pdf"        output_path = os.path.join(output_dir, pdf_name)        try:            wb = excel.Workbooks.Open(os.path.abspath(input_path))            wb.ExportAsFixedFormat(0, os.path.abspath(output_path))            wb.Close()            print(f"✓ {filename} → {pdf_name}")        except Exception as e:            print(f"✗ {filename} 失败: {str(e)}")    excel.Quit()    print("\n批量转换完成!")batch_excel_to_pdf("./excel_files""./pdf_output")

Excel 转 PDF 的常见问题:

  1. 内容被截断:Excel 列太多,转 PDF 后右边被切掉。解决方法:在 Excel 中设置 "将所有列调整为一页":
# 设置所有列适应一页宽for ws in wb.Worksheets:    ws.PageSetup.Zoom = False    ws.PageSetup.FitToPagesWide = 1    ws.PageSetup.FitToPagesTall = False  # 高度不限制

  1. 只转换了第一个 Sheet:ExportAsFixedFormat 默认转换所有 Sheet。如果只想转特定 Sheet,需要先选中:wb.Sheets("Sheet1").ExportAsFixedFormat(0, pdf_path)
  2. 打印区域问题:如果 Excel 设置了打印区域,只会转换打印区域内的内容。可以用 ws.PageSetup.PrintArea = "" 清除打印区域。

05 PDF 转图片

PDF 转图片常用两个库:pdf2image(基于 poppler,效果好)和PyMuPDF(fitz)(轻量,速度快)。

方案一:pdf2image(推荐,效果好)

pdf2image 依赖 poppler,需要先安装:

  • Windows:下载 poppler-windows,解压后把 bin 目录加入 PATH
  • Mac:brew install poppler
  • Linux:sudo apt install poppler-utils
pip install pdf2image

单文件转换(全部页):

from pdf2image import convert_from_pathimport osdef pdf_to_images(pdf_path, output_dir, dpi=200):    os.makedirs(output_dir, exist_ok=True)    # Windows需要指定poppler路径    # poppler_path = "C:/poppler-xx.x.x/bin"    # images = convert_from_path(pdf_path, dpi=dpi, poppler_path=poppler_path)    images = convert_from_path(pdf_path, dpi=dpi)    for i, img in enumerate(images, start=1):        output_path = os.path.join(output_dir, f"page_{i:03d}.png")        img.save(output_path, "PNG")        print(f"已保存: {output_path}")    print(f"转换完成!共 {len(images)} 页")pdf_to_images("document.pdf""./images")

只转换指定页:

from pdf2image import convert_from_path# 只转第1到第3页images = convert_from_path("document.pdf", dpi=200, first_page=1, last_page=3)

方案二:PyMuPDF(fitz,轻量快速)

pip install pymupdfimport fitz  # PyMuPDFimport osdef pdf_to_images_fitz(pdf_path, output_dir, dpi=200):    os.makedirs(output_dir, exist_ok=True)    doc = fitz.open(pdf_path)    # 计算缩放比例(默认72dpi,目标dpi需要缩放)    zoom = dpi / 72    mat = fitz.Matrix(zoom, zoom)    for page_num in range(len(doc)):        page = doc[page_num]        pix = page.get_pixmap(matrix=mat)        output_path = os.path.join(output_dir, f"page_{page_num + 1:03d}.png")        pix.save(output_path)        print(f"已保存: {output_path}")    doc.close()    print(f"转换完成!共 {len(doc)} 页")pdf_to_images_fitz("document.pdf""./images")

两种方案对比:

  • pdf2image:渲染效果更好,对复杂 PDF 兼容性好,但需要安装 poppler 依赖。
  • PyMuPDF:纯 Python 包(pip 安装即可,无外部依赖),速度快,内存占用低,渲染效果略逊于 pdf2image 但日常够用。

批量 PDF 转图片:

import fitzimport osdef batch_pdf_to_images(input_dir, output_root, dpi=200):    pdf_files = [f for f in os.listdir(input_dir) if f.lower().endswith(".pdf")]    zoom = dpi / 72    mat = fitz.Matrix(zoom, zoom)    for filename in pdf_files:        pdf_path = os.path.join(input_dir, filename)        # 每个PDF创建单独的文件夹        folder_name = os.path.splitext(filename)[0]        output_dir = os.path.join(output_root, folder_name)        os.makedirs(output_dir, exist_ok=True)        try:            doc = fitz.open(pdf_path)            for page_num in range(len(doc)):                page = doc[page_num]                pix = page.get_pixmap(matrix=mat)                output_path = os.path.join(output_dir, f"page_{page_num + 1:03d}.png")                pix.save(output_path)            doc.close()            print(f"✓ {filename} → {len(doc)}页")        except Exception as e:            print(f"✗ {filename} 失败: {str(e)}")batch_pdf_to_images("./pdf_files""./images_output")

06 常见坑与解决方案

坑 1:pywin32 转换时 Word/Excel 弹出对话框卡住

常见原因:文档有修复提示、宏警告、兼容性提示。解决方法:1)确保源文件正常;2)设置 DisplayAlerts = False(Excel);3)Word 可以用 word.DisplayAlerts = 0

坑 2:pywin32 转换后进程残留

如果脚本异常退出,Word/Excel 进程可能残留在后台。用任务管理器手动结束 WINWORD.EXE 或 EXCEL.EXE 进程。代码中一定要用 try-finally 确保 Quit 被调用。

坑 3:LibreOffice 转换中文乱码

确保系统安装了中文字体。Linux 下安装文泉驿字体:sudo apt install fonts-wqy-zenhei fonts-wqy-microhei

坑 4:pdf2image 报错 "Unable to get page count"

poppler 没安装或路径不对。Windows 用户必须指定 poppler_path 参数,指向 poppler 的 bin 目录。或者改用 PyMuPDF,无外部依赖。

坑 5:PDF 转图片后文字模糊

提高 DPI。默认可能是 150dpi,打印质量建议 300dpi,屏幕查看 200dpi 足够。DPI 越高图片越清晰,但文件越大、转换越慢。

写在最后

  格式转换是 PDF 自动化中非常实用的一环。Word/Excel 转 PDF 适合用 pywin32(Windows)或 LibreOffice(跨平台),PDF 转图片推荐 PyMuPDF(轻量无依赖)或 pdf2image(效果好)。掌握这些,你就能批量处理几十上百份文件的格式转换,再也不用一个个打开另存为了。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-09-05 04:16:17 HTTP/2.0 GET : https://f.mffb.com.cn/a/512420.html
  2. 运行时间 : 0.070401s [ 吞吐率:14.20req/s ] 内存消耗:4,689.89kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=28d9501691590366d97299acc4d4f1c7
  1. /www/wwwroot/mffb/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /www/wwwroot/mffb/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /www/wwwroot/mffb/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /www/wwwroot/mffb/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /www/wwwroot/mffb/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /www/wwwroot/mffb/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /www/wwwroot/mffb/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /www/wwwroot/mffb/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /www/wwwroot/mffb/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /www/wwwroot/mffb/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /www/wwwroot/mffb/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /www/wwwroot/mffb/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /www/wwwroot/mffb/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /www/wwwroot/mffb/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /www/wwwroot/mffb/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /www/wwwroot/mffb/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /www/wwwroot/mffb/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /www/wwwroot/mffb/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /www/wwwroot/mffb/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /www/wwwroot/mffb/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /www/wwwroot/mffb/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /www/wwwroot/mffb/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /www/wwwroot/mffb/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /www/wwwroot/mffb/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /www/wwwroot/mffb/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /www/wwwroot/mffb/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /www/wwwroot/mffb/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /www/wwwroot/mffb/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /www/wwwroot/mffb/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /www/wwwroot/mffb/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /www/wwwroot/mffb/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /www/wwwroot/mffb/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /www/wwwroot/mffb/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /www/wwwroot/mffb/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /www/wwwroot/mffb/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /www/wwwroot/mffb/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /www/wwwroot/mffb/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /www/wwwroot/mffb/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /www/wwwroot/mffb/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /www/wwwroot/mffb/f.mffb.com.cn/runtime/temp/ee3f15ab4905c6d51f7fc3c6e12961f5.php ( 11.95 KB )
  140. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000514s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000544s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000248s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000209s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000341s ]
  6. SELECT * FROM `set` [ RunTime:0.000172s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000404s ]
  8. SELECT * FROM `article` WHERE `id` = 512420 LIMIT 1 [ RunTime:0.001028s ]
  9. UPDATE `article` SET `lasttime` = 1788552977 WHERE `id` = 512420 [ RunTime:0.003027s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000213s ]
  11. SELECT * FROM `article` WHERE `id` < 512420 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000255s ]
  12. SELECT * FROM `article` WHERE `id` > 512420 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000904s ]
  13. SELECT * FROM `article` WHERE `id` < 512420 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.003132s ]
  14. SELECT * FROM `article` WHERE `id` < 512420 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.002105s ]
  15. SELECT * FROM `article` WHERE `id` < 512420 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.004132s ]
0.078730s