当前位置:首页>python>Python进阶-19:Python办公自动化,掌握CSV、Word、Excel、PPT、PDF文件操作

Python进阶-19:Python办公自动化,掌握CSV、Word、Excel、PPT、PDF文件操作

  • 2026-02-22 22:13:50
Python进阶-19:Python办公自动化,掌握CSV、Word、Excel、PPT、PDF文件操作

在日常工作中,经常要处理各种文件,Python到底怎么操作CSV、Word、Excel这些办公文件呢?有很多简单重复的劳动如何交给 Python 程序来处理呢?今天就给大家做一个系统的总结,把Python操作各种办公文件的核心要点都梳理清楚,记得收藏!

一、CSV文件操作

CSV是最简单、最通用的数据格式。Python内置的csv模块就够用了。

核心代码

import csv# 写入CSV文件with open('output.csv''w', encoding='utf-8', newline=''as f:# w 为写    writer = csv.writer(f)    writer.writerow(['姓名''年龄''城市'])  # 写表头    writer.writerow(['张三'25'北京'])     # 写数据行    writer.writerows([['李四'30'上海'],   # 批量写多行                      ['王五'28'广州']])# 读取CSV文件with open('output.csv''r', encoding='utf-8'as f:# r为读    reader = csv.reader(f)    for row in reader:        print(row)  # 每一行是一个列表
运行结果为:

注意:如果读取文件时,文件不存在会报错。因此,这里采用先建(写入)一个CSV文件,再读取的步骤,如果已有文件,可以直接读取。

使用字典形式(推荐)

# 写入字典数据with open('output.csv''w', encoding='utf-8', newline=''as f:    fieldnames = ['姓名''年龄''城市']    writer = csv.DictWriter(f, fieldnames=fieldnames)    writer.writeheader()  # 写表头    writer.writerow({'姓名''张三''年龄'25'城市''北京'})# 读取为字典with open('data.csv''r', encoding='utf-8'as f:    reader = csv.DictReader(f)    for row in reader:        print(row['姓名'], row['城市'])  # 通过列名访问

运行结果

张三 北京

要点总结:

  • newline=''防止写入时出现空行

  • 指定encoding='utf-8'避免中文乱码

  • csv.DictReader/DictWriter让代码更易读

二、Excel文件操作

Python 操作 Excel 需要三方库的支持,如果要兼容 Excel 2007 以前的版本,也就是xls格式的 Excel 文件,可以使用三方库xlrd和xlwt,前者用于读 Excel 文件,后者用于写 Excel 文件。如果使用较新版本的 Excel,即xlsx格式的 Excel 文件,可以使用openpyxl库,当然这个库不仅仅可以操作Excel,还可以操作其他基于 Office Open XML 的电子表格文件。推荐使用openpyxl(处理.xlsx)或pandas(数据分析场景)。

安装环境

pip install openpyxl pandas

使用openpyxl

import openpyxl# 写入Excelwb = openpyxl.Workbook()sheet = wb.activesheet.title = '员工信息'# 写入表头sheet['A1'] = '姓名'sheet['B1'] = '年龄'sheet['C1'] = '城市'# 写入数据sheet.append(['张三'25'北京'])sheet.append(['李四'30'上海'])# 设置样式from openpyxl.styles import Font, Alignmentsheet['A1'].font = Font(bold=True)  # 加粗sheet['A1'].alignment = Alignment(horizontal='center')  # 居中# 保存wb.save('output.xlsx')# 读取Excelwb = openpyxl.load_workbook('data.xlsx')sheet = wb.active  # 获取活动工作表# 或 sheet = wb['Sheet1']  # 按名称获取# 读取单元格cell_value = sheet['A1'].valuecell_value = sheet.cell(row=1, column=1).value# 遍历所有行for row in sheet.iter_rows(min_row=1, values_only=True):# min_row=1 从第1行开始,如果改为 min_row=2 则第1行表头不显示    name, age, city = row  # 假设第一行是表头    print(name, age, city)

运行结果:(min_row=1,)

姓名 年龄 城市张三 25 北京李四 30 上海

运行结果:(min_row=2,

张三 25 北京李四 30 上海

使用pandas(更简洁)

import pandas as pd# 写入Exceldf = pd.DataFrame({    '姓名': ['张三''李四''王五'],    '年龄': [253028],    '城市': ['北京''上海''广州']})df.to_excel('output.xlsx', index=False)  # index=False不写行号# 读取Exceldf = pd.read_excel('data.xlsx', sheet_name='Sheet1')print(df.head())  # 默认查看前5行,查看更多行在括号中加入行数

运行结果:

   姓名  年龄  城市0  张三  25  北京1  李四  30  上海2  王五  28  广州

要点总结:

  • openpyxl适合精细控制,pandas适合数据分析

  • 处理大文件时用read_only模式节省内存

  • iter_rows()比直接遍历效率更高

三、Word文件操作

操作Word主要用python-docx库。

安装

pip install python-docx

读取Word

from docx import Document# 打开文档doc = Document('example.docx')# 读取所有段落for para in doc.paragraphs:    print(para.text)# 读取表格for table in doc.tables:    for row in table.rows:        for cell in row.cells:            print(cell.text)

创建和修改Word

from docx import Documentfrom docx.shared import Pt, Inchesfrom docx.enum.text import WD_ALIGN_PARAGRAPH# 创建新文档doc = Document()# 添加标题doc.add_heading('工作报告', level=1)# 添加段落p = doc.add_paragraph('这是第一段内容。')# 更完整的字体样式控制run = p.add_run('带样式的文本')run.bold = True                    # 加粗run.italic = True                  # 斜体run.underline = True                # 下划线run.font.size = Pt(14)              # 字体大小run.font.name = '微软雅黑'           # 字体run.font.color.rgb = RGBColor(25500)  # 红色# 段落对齐方式p.alignment = WD_ALIGN_PARAGRAPH.CENTER  # 居中# 可选:LEFT, RIGHT, JUSTIFY 等# 段落缩进from docx.shared import Inchesp.paragraph_format.left_indent = Inches(0.5)  # 左缩进p.paragraph_format.first_line_indent = Inches(0.3)  # 首行缩进p.paragraph_format.space_before = Pt(12)  # 段前间距p.paragraph_format.space_after = Pt(12)   # 段后间距# 添加表格table = doc.add_table(rows=3, cols=3)table.style = 'Table Grid'  # 设置表格样式table.cell(0,0).text = '姓名'table.cell(0,1).text = '年龄'table.cell(0,2).text = '城市'# 表格样式列表table.style = 'Light Grid Accent 1'  # 可选样式:# 'Table Grid' - 标准网格# 'Light List' - 浅色列表# 'Medium Grid 3' - 中等网格# 'Dark List' - 深色列表# 合并单元格table = document.add_table(rows=3, cols=3)table.cell(00).merge(table.cell(02))  # 合并第一行前三列# 设置列宽for cell in table.columns[0].cells:    cell.width = Cm(3)# 添加图片doc.add_picture('chart.png', width=Inches(5))# 添加页眉section = document.sections[0]header = section.headerheader_para = header.paragraphs[0]header_para.text = "这是页眉内容"# 添加页脚footer = section.footerfooter_para = footer.paragraphs[0]footer_para.text = "第 1 页"# 保存doc.save('output.docx')

要点总结:

  • add_run()添加连续文本,可以设置不同样式

  • 段落和单元格里的文本要通过add_paragraph()添加

  • 表格操作比Excel复杂,建议先创建再填充

完整的实用示例

from docx import Documentfrom docx.shared import Cm, Pt, RGBColor, Inchesfrom docx.enum.text import WD_ALIGN_PARAGRAPHfrom docx.enum.table import WD_TABLE_ALIGNMENTfrom datetime import datetimedef create_work_report(title, author, content_list, table_data):    """    创建工作报告的完整示例    """    doc = Document()    # 1. 设置页边距    sections = doc.sections    for section in sections:        section.top_margin = Cm(2.5)        section.bottom_margin = Cm(2.5)        section.left_margin = Cm(2.5)        section.right_margin = Cm(2.5)    # 2. 添加标题    title_para = doc.add_paragraph()    title_para.alignment = WD_ALIGN_PARAGRAPH.CENTER    run = title_para.add_run(title)    run.font.size = Pt(20)    run.font.bold = True    run.font.name = '黑体'    # 3. 添加作者和日期信息    info_para = doc.add_paragraph()    info_para.alignment = WD_ALIGN_PARAGRAPH.CENTER    info_para.add_run(f"报告人:{author}    ")    info_para.add_run(f"日期:{datetime.now().strftime('%Y年%m月%d日')}")    # 4. 添加内容    for i, content in enumerate(content_list, 1):        # 添加小标题        heading = doc.add_heading(f'{i}{content["title"]}', level=2)        # 添加正文        p = doc.add_paragraph(content['text'])        p.paragraph_format.first_line_indent = Inches(0.3)        # 如果有列表项        if 'items' in content:            for item in content['items']:                doc.add_paragraph(item, style='List Bullet')        # 如果有图片        if 'image' in content:            doc.add_picture(content['image'], width=Cm(12))            # 添加图片说明            caption = doc.add_paragraph(content.get('caption'''))            caption.alignment = WD_ALIGN_PARAGRAPH.CENTER            caption.runs[0].italic = True    # 5. 添加数据表格    doc.add_heading('数据统计', level=1)    if table_data:        table = doc.add_table(rows=len(table_data), cols=len(table_data[0]))        table.style = 'Light Grid Accent 1'        table.alignment = WD_TABLE_ALIGNMENT.CENTER        # 填充表格数据        for i, row_data in enumerate(table_data):            row = table.rows[i]            for j, cell_data in enumerate(row_data):                row.cells[j].text = str(cell_data)                # 设置表头样式                if i == 0:                    row.cells[j].paragraphs[0].runs[0].font.bold = True        # 6. 添加页眉页脚        section = doc.sections[0]        # 添加页眉        header = section.header        header_para = header.paragraphs[0]        header_para.text = f"{title} - 内部资料"        header_para.alignment = WD_ALIGN_PARAGRAPH.CENTER        # 添加页脚(使用页码字段)        footer = section.footer        footer_para = footer.paragraphs[0]        footer_para.text = "内部资料"        footer_para.alignment = WD_ALIGN_PARAGRAPH.CENTER    # 7. 保存文档    filename = f"{title}_{datetime.now().strftime('%Y%m%d')}.docx"    doc.save(filename)    print(f"报告已生成:{filename}")    return filename

运行结果:

报告已生成:2025年2月工作报告_20260213.docx

在文件目录中,多一个名为2025年2月工作报告_20260213的docx文件,打开后如下图所示

四、PowerPoint文件操作

使用python-pptx库操作PPT。

安装

pip install python-pptx

读取PPT

from pptx import Presentation# 打开演示文稿prs = Presentation('example.pptx')# 遍历所有幻灯片for slide in prs.slides:    # 遍历幻灯片中的所有形状    for shape in slide.shapes:        if hasattr(shape, "text"):  # 如果是文本框            print(shape.text)        if shape.has_table:  # 如果是表格            table = shape.table            for row in table.rows:                for cell in row.cells:                    print(cell.text)

创建PPT

from pptx import Presentationfrom pptx.util import Inches, Ptfrom pptx.enum.text import PP_ALIGNfrom pptx.dml.color import RGBColor# 创建演示文稿prs = Presentation()# 选择布局(0是标题幻灯片,1是标题和内容,等等)slide_layout = prs.slide_layouts[1]slide = prs.slides.add_slide(slide_layout)# 设置标题title = slide.shapes.titletitle.text = "Python自动化办公"# 设置内容content = slide.placeholders[1]text_frame = content.text_frametext_frame.text = "主要知识点:"# 添加项目符号p = text_frame.add_paragraph()p.text = "CSV文件操作"p.level = 1  # 缩进级别p = text_frame.add_paragraph()p.text = "Excel文件操作"p.level = 1# 添加新幻灯片slide2 = prs.slides.add_slide(prs.slide_layouts[5])  # 空白幻灯片left = top = Inches(1)width = Inches(8)height = Inches(1)# 添加文本框txBox = slide2.shapes.add_textbox(left, top, width, height)tf = txBox.text_frametf.text = "这是新添加的文本框"# 保存prs.save('output.pptx')

运行结果:

在文件目录中,多一个名为output的PPT文件,打开后如下图所示

要点总结:

  • PPT有布局概念,选择合适布局很重要

  • 占位符(placeholder)是预定义好的位置

  • 添加内容前要先获取或创建形状

五、PDF文件操作

PDF操作分为:读取内容(PyPDF2/pdfplumber)和创建PDF(reportlab/fpdf)。

安装

pip install PyPDF2 pdfplumber reportlab

读取PDF(PyPDF2 - 适合基础操作)

import PyPDF2# 读取PDFwith open('example.pdf''rb'as file:    reader = PyPDF2.PdfReader(file)    # 获取页数    num_pages = len(reader.pages)    print(f'总页数: {num_pages}')    # 读取第一页内容    page = reader.pages[0]    text = page.extract_text()    print(text)    # 合并PDF    writer = PyPDF2.PdfWriter()    writer.add_page(page)    # 保存新PDF    with open('output.pdf''wb'as output:        writer.write(output)

读取PDF(pdfplumber - 适合表格和复杂布局)

import pdfplumberwith pdfplumber.open('example.pdf'as pdf:    # 获取第一页    page = pdf.pages[0]    # 提取文本    text = page.extract_text()    # 提取表格    table = page.extract_table()    for row in table:        print(row)

创建PDF(reportlab)

from reportlab.lib.pagesizes import letterfrom reportlab.pdfgen import canvasfrom reportlab.lib.units import inch# 创建PDFc = canvas.Canvas("output.pdf", pagesize=letter)# 设置字体c.setFont("Helvetica"12)# 写文本c.drawString(100750"Hello, PDF!")c.drawString(100735"这是第二行文本")# 设置颜色c.setFillColorRGB(1,0,0)  # 红色c.drawString(100720"红色文字")# 画线c.line(100700500700)# 画矩形c.rect(100650200100)# 保存c.save()

运行结果:

在文件目录中,多一个名为output的pdf文件

打开后如下图所示

要点总结:

  • PyPDF2适合PDF合并、分割、旋转等操作

  • pdfplumber提取表格和复杂文本更准确

  • reportlab创建PDF功能强大但学习曲线较陡

六、实战小技巧

1. 异常处理

try:    # 文件操作代码    with open('file.xlsx''rb'as f:        # ...except FileNotFoundError:    print("文件不存在")except Exception as e:    print(f"出错啦:{e}")

2. 批量处理

import osimport glob# 批量处理Excel文件for file in glob.glob('data/*.xlsx'):    df = pd.read_excel(file)    # 处理数据...    df.to_excel(f'processed/{os.path.basename(file)}')

3. 路径处理

from pathlib import Path# 现代路径处理方式data_dir = Path('data')output_dir = Path('output')# 确保目录存在output_dir.mkdir(exist_ok=True)# 组合路径file_path = data_dir / 'report.xlsx'

Python操作办公文件的生态已经非常成熟,记住这几条原则:

  • CSV:数据交换的首选,简单轻量

  • Excel:数据分析用pandas,格式控制用openpyxl

  • Word:文档生成用python-docx

  • PPT:演示文稿用python-pptx

  • PDF:读取用pdfplumber,操作用PyPDF2

最关键的还是多练习!把常用的代码片段整理成自己的工具函数库,以后工作中遇到就能信手拈来。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-28 21:30:35 HTTP/2.0 GET : https://f.mffb.com.cn/a/475483.html
  2. 运行时间 : 0.090680s [ 吞吐率:11.03req/s ] 内存消耗:4,545.54kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=0ecf99a8ed691b0c7982e9218853202f
  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.000494s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000604s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000320s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000258s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000489s ]
  6. SELECT * FROM `set` [ RunTime:0.000199s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000612s ]
  8. SELECT * FROM `article` WHERE `id` = 475483 LIMIT 1 [ RunTime:0.000413s ]
  9. UPDATE `article` SET `lasttime` = 1772285435 WHERE `id` = 475483 [ RunTime:0.000600s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000217s ]
  11. SELECT * FROM `article` WHERE `id` < 475483 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000392s ]
  12. SELECT * FROM `article` WHERE `id` > 475483 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000409s ]
  13. SELECT * FROM `article` WHERE `id` < 475483 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.000718s ]
  14. SELECT * FROM `article` WHERE `id` < 475483 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.000955s ]
  15. SELECT * FROM `article` WHERE `id` < 475483 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.000605s ]
0.092340s