当前位置:首页>python>Python处理Excel最全指南:从性能提升500%到让报表自动刷新

Python处理Excel最全指南:从性能提升500%到让报表自动刷新

  • 2026-07-02 16:31:13
Python处理Excel最全指南:从性能提升500%到让报表自动刷新

老板又在催报表了。你打开那个500MB的Excel,电脑风扇开始哀嚎,鼠标转圈圈……你心里只有一个念头:要是能像刷短视频一样,让这些数据“唰”一下自己排好队,那该多好。

没错,我说的就是Python。

很多人以为Python搞Excel只是替代VBA,那就太小看它了。它能让你处理10万行数据的速度提升500%,能让你每天重复的报表工作变成一键生成,甚至能让报表在半夜自动刷新,第二天一早发到你邮箱。

我用Python处理Excel已经五年,从最开始的openpyxl,到后来的pandas、xlwings,踩过的坑比写过的代码还多。今天这篇文章,就是把我五年积累的全部经验,整理成一套“选刀-磨刀-用刀”的完整指南。

选错刀,累死牛。 接下来我说的每一句话,都值你半小时的百度时间。

四大“杀器”选哪把?先看你要切什么肉

Python操作Excel的库多到数不清,但常用的也就这几把“刀”:openpyxl、pandas、xlwings、xlsxwriter。

新手最容易犯的错,就是拿砍骨刀去切豆腐——用openpyxl读10万行数据,或者用pandas去改单元格背景色。结果不是慢成狗,就是根本办不到

选工具的核心逻辑,就是看你的真实需求是什么:

你的需求是什么最佳选择一句话说清优势
读数据,做分析,算指标pandas
DataFrame的筛选、聚合、透视,比Excel公式灵活十倍。一行 read_excel() 数据全进来,玩似的。
读写已有文件,改格式、加公式openpyxl
功能最全的纯Python方案。单元格样式、条件格式、图表、批注……Excel里能干的,它基本都能干。
纯生成新报表,追求“速度与激情”xlsxwriter写入速度是openpyxl的3-5倍!
 边写边设格式,适合数据跑完“吐”一张漂亮报表的场景。
操控Excel程序本身,刷新透视表、跑宏xlwings
通过COM接口直接“附身”Excel程序。你在Excel里手动能干的一切,它都能用Python代码干。

举个实际场景:

销售小王每天要合并10个分公司的Excel报表,然后做透视分析,最后生成一张带格式的总结报告发给老板

他的最佳操作流是:pandas(合并+分析) → xlsxwriter(快速写入数据+基础格式) → openpyxl(精细化修饰格式) → xlwings(自动打开文件刷新图表)

明白了吗?没有一把“万能刀”。但组合起来,你就是庖丁,Excel是那头牛。


第一把刀:openpyxl —— 你的“格式装修队”

当你的需求是“读一个已有的Excel,改点内容,加个颜色,调下格式,再存回去”,openpyxl就是你的标准答案。

它像一个细心的装修队,能读懂Excel文件的每一处细节(样式、公式、图表),也能按你的要求进行精装修。

核心三板斧:记住这三个对象就够了

openpyxl的世界围绕三个核心转:Workbook(工作簿)Worksheet(工作表)Cell(单元格)

import openpyxl

# 1. 读取文件
wb = openpyxl.load_workbook("销售数据.xlsx")  # 打开工作簿
ws = wb["Sheet1"]  # 选中名为“Sheet1”的工作表,或者用 wb.active 选当前激活的

# 2. 读取数据(三种姿势,总有一款适合你)
title = ws["A1"].value  # 姿势一:像Excel一样用坐标 “A1”
price = ws.cell(row=5, column=3).value  # 姿势二:用行号列号 (第5行,第3列)

# 姿势三(处理大表必备):用迭代器,省内存!
for row in ws.iter_rows(min_row=2, values_only=True):  # 从第2行开始,只取值
    date, product, sales = row  # 直接解包
# 处理你的数据...

# 3. 写入并保存
ws["A1"] = "2024年销售总览"# 写入新标题
ws.cell(row=10, column=5, value=99999)  # 在E10单元格写入数字

wb.save("修改后_销售数据.xlsx")  # 另存为新文件!千万别直接覆盖原文件
wb.close()  # 好习惯,关闭文件释放内存

把表格变高级:样式控制代码模板

一张专业的报表,格式占一半分数。Openpyxl的样式设置稍微有点啰嗦,但功能强大。直接复制这段代码去改

from openpyxl.styles import Font, PatternFill, Alignment, Border, Side

# 先定义“涂料”(样式对象)
header_fill = PatternFill(start_color="2F5496", end_color="2F5496", fill_type="solid")  # 深蓝色背景
header_font = Font(name="微软雅黑", size=12, bold=True, color="FFFFFF")  # 白色加粗字体
center_align = Alignment(horizontal="center", vertical="center")  # 居中
thin_border = Border(left=Side(style="thin"), right=Side(style="thin"),
                      top=Side(style="thin"), bottom=Side(style="thin"))  # 细边框
money_format = "#,#
#0.00"# 千分位,两位小数

# 然后“刷墙”(应用到单元格)
ws["A1"].font = header_font
ws["A1"].fill = header_fill
ws["A1"].alignment = center_align
ws["A1"].border = thin_border
ws["B2"].number_format = money_format  # 数字格式

# 批量“刷墙”:把第一行都设置成漂亮表头
for cell in ws[1]:  # ws[1] 表示第一行所有单元格
    cell.fill = header_fill
    cell.font = header_font
    cell.alignment = center_align

让数据自己说话:条件格式与数据验证

想让销售额大于10万的自动标红?想让用户只能在下拉列表里选城市?Openpyxl轻松搞定。

from openpyxl.formatting.rule import CellIsRule
from openpyxl.worksheet.datavalidation import DataValidation

# 条件格式:B列大于100000的标红
red_fill = PatternFill(start_color="FF6B6B", end_color="FF6B6B", fill_type="solid")
ws.conditional_formatting.add("B2:B1000",
    CellIsRule(operator="greaterThan", formula=["100000"], fill=red_fill)
)

# 数据验证:在A列创建城市下拉列表
dv = DataValidation(type="list", formula1='"北京,上海,广州,深圳"', allow_blank=True)
dv.errorTitle = "输入错误"
dv.error = "请从列表中选择城市!"
ws.add_data_validation(dv)
dv.add("A2:A1000")  # 应用到A2到A1000单元格

性能大坑提醒:遇到大文件怎么办?

Openpyxl默认会把整个Excel文件加载到内存里。如果你打开一个100MB的文件,内存占用可能飙到1GB。

解决办法:启动“只读模式”

# 用这个参数,内存占用立减90%
wb = openpyxl.load_workbook("超级大的文件.xlsx", read_only=True)
ws = wb.active

# 注意!只读模式下,你只能像读流水账一样一行行读,不能随机访问,也不能修改。
for row in ws.iter_rows(values_only=True):
# 处理每一行数据
pass

wb.close()

第二把刀:pandas —— 你的“数据分析大脑”

如果你的目标是分析数据,而不是折腾单元格格式,请直接上pandas。它会把你从Excel的函数公式里彻底解放出来。

你可以把它想象成一个超级智能的Excel透视表+筛选器+计算器合体。

读取数据,精准狙击

Pandas的read_excel函数强大到令人发指,你可以精确控制要读什么。

import pandas as pd

# 基础读法
df = pd.read_excel("data.xlsx", sheet_name="销售数据")  # df 就是一个强大的 DataFrame 对象
print(df.head())  # 看一眼前5行

# 高级读法:我只想要某些列,跳过乱七八糟的表头
# 这招对付从系统导出的“脏”表格特别管用
df = pd.read_excel("data.xlsx",
                   usecols=["日期""产品""销售额"],  # 只读这三列
                   skiprows=3,     # 跳过前3行(比如公司logo和空行)
                   nrows=10000)    # 只读10000行,避免内存爆炸

# 一键读取所有工作表,返回一个“工作表名: DataFrame”的字典
all_sheets = pd.read_excel("data.xlsx", sheet_name=None)
for sheet_name, sheet_data in all_sheets.items():
    print(f"工作表【{sheet_name}】有 {len(sheet_data)} 行数据")

数据分析,行云流水

这才是pandas的精华。下面这些操作,在Excel里你要折腾半天,在这里就是一行代码。

# 1. 筛选:找出北京地区销售额大于5万的订单
high_sales_bj = df[(df["地区"] == "北京") & (df["销售额"] > 50000)]

# 2. 分组聚合:按地区统计销售总额、平均单价、订单数
summary = df.groupby("地区", as_index=False).agg(
    销售总额=("销售额""sum"),
    平均单价=("单价""mean"),
    订单数=("订单号""nunique")  # nunique是统计不重复的个数,很重要!
)

# 3. 透视表:制作地区vs月份的销售额汇总
groupby等分组操作是行转列,pivot_table则直接输出二维报表。
pivot_table = df.pivot_table(
    values="销售额",    # 要计算的值
    index="地区",      # 行标签
    columns="月份",    # 列标签
    aggfunc="sum",     # 聚合函数(求和)
    fill_value=0# 空值填0
)

# 4. 新增计算列:计算环比增长、累计占比
df["环比增长"] = df.groupby("产品")["销售额"].pct_change()  # 同产品比上月
# 累计销售额占比
# `cumsum()`是计算累计和。
df["累计占比"] = df["销售额"].cumsum() / df["销售额"].sum()

# 5. 排序取TOP10
top10_products = df.groupby("产品")["销售额"].sum().nlargest(10)

写入Excel:如何把多个DataFrame写到不同Sheet?

Pandas写Excel同样方便,配合ExcelWriter,可以轻松制作多工作表报告。

# 准备三个分析结果
df_raw = ...  # 原始数据
df_summary = ...  # 汇总表
df_pivot = ...   # 透视表

# 使用 ExcelWriter 一次性写入多个sheet
with pd.ExcelWriter("分析报告.xlsx", engine="openpyxl"as writer:
    df_raw.to_excel(writer, sheet_name="原始数据", index=False)
    df_summary.to_excel(writer, sheet_name="数据汇总", index=False)
    df_pivot.to_excel(writer, sheet_name="月度透视")

# 小提示:to_excel 里的 index=False 通常建议加上,避免多出一列行号。

一个黄金组合:Pandas + Openpyxl

Pandas写数据快,但设置复杂格式麻烦。Openpyxl设格式强,但处理大量数据慢。所以业内标准做法是:

  1. 用Pandas做所有复杂的数据清洗、计算、分析。
  2. 用Pandas的to_excel把结果数据快速写进Excel。
  3. 再用Openpyxl打开这个Excel,进行精细的格式美化(加颜色、调边框、设字体)。

第三把刀:xlsxwriter —— “报表印刷机”,速度之王

当你需要从零生成一个全新的、格式复杂的、数据量巨大的报表时,xlsxwriter是你的不二之选。

它只写不读,像个专注的印刷机,速度极快。而且它的API设计让你可以边写数据边设定格式,一气呵成。

核心优势:速度与格式的完美融合

import xlsxwriter

wb = xlsxwriter.Workbook("超快报表.xlsx")
ws = wb.add_worksheet("业绩看板")  # 创建工作表

# 1. 定义格式(像定义CSS样式一样,可以重复使用)
header_style = wb.add_format({
"bold"True,
"font_color""white",
"bg_color""#2F5496",  # 蓝色背景
"align""center",
"valign""vcenter",
"border"1,
"font_size"12
})

money_style = wb.add_format({"num_format""#,##0.00""align""right"})

# 2. 设置列宽(让表格更美观)
ws.set_column("A:A"15)  # A列宽15
ws.set_column("B:E"10)  # B到E列宽10

# 3. 写入带格式的表头
headers = ["日期""产品""销量""单价""销售额"]
for col, header in enumerate(headers):  # enumerate 能同时拿到索引和值
    ws.write(0, col, header, header_style)  # 第0行,第col列

# 4. 写入数据(每条数据都可以单独套格式)
data = [
    ["2024-01-15""产品A"12050.0"=C2*D2"],  # 销售额用公式计算!
    ["2024-01-16""产品B"8580.0"=C3*D3"],
]
for row_idx, row_data in enumerate(data, 1):  # 从第1行开始写(第0行是表头)
for col_idx, cell_value in enumerate(row_data):
        style = money_style if col_idx in [34elseNone# 单价和销售额列用货币格式
        ws.write(row_idx, col_idx, cell_value, style)

# 5. 插入图表(让你的报表生动起来)
chart = wb.add_chart({"type""column"})  # 柱状图
# 告诉图表数据从哪里来
chart.add_series({
"name""销售额",
"categories""=业绩看板!$B$2:$B$3",  # 产品名称作为X轴
"values":     "=业绩看板!$E$2:$E$3",   # 销售额作为Y轴
})
chart.set_title({"name""产品销售对比图"})
ws.insert_chart("G2", chart)  # 把图表插入到G2单元格的位置

wb.close()
print("报表生成完毕!速度飞快!")

记住:xlsxwriter不能修改已有文件,它是纯粹的“生成器”。但它生成的速度和效果,是顶级的。


第四把刀:xlwings —— 让Python“附身”Excel,实现终极自动化

上面三个库,都是在“文件层面”操作Excel。而xlwings更狠,它直接操控Excel这个软件本身

这意味着,所有你能在Excel里手动完成的操作——点鼠标、刷新透视表、运行VBA宏、甚至弹窗提示——xlwings都能用Python代码帮你自动完成。

它能做什么?只有你想不到,没有它做不到

import xlwings as xw
import pandas as pd

# 1. 启动Excel程序(可以看不见,也可以让它显示出来)
app = xw.App(visible=True)  # visible=True 让你能看到Excel被打开操作的过程,很炫酷
wb = app.books.open("需要刷新的报表.xlsx")  # 打开文件
ws = wb.sheets["Sheet1"]

# 2. 像VBA一样读写单元格
ws.range("A1").value = "数据已更新:" + str(pd.Timestamp("today"))
# 读取一块区域,直接变成Python的列表,或者Pandas的DataFrame!
table_data = ws.range("A1:E100").options(pd.DataFrame, index=False, header=True).value

# 3. 设置格式(颜色、字体、边框)
ws.range("A1:E1").color = (68114196)  # RGB颜色,设置表头背景为蓝色
ws.range("A1:E1").api.Font.Color = 0xFFFFFF# 设置字体为白色 (.api是通往VBA世界的大门)
ws.range("A1:E1").api.Font.Bold = True# 设置加粗

# 4. 核心技能:刷新所有数据透视表和数据连接
# 这功能太实用了!报表数据源更新后,一键全刷新。
for sheet in wb.sheets:
for pivot_table in sheet.api.PivotTables():  # 遍历所有透视表
        pivot_table.RefreshTable()
# 还可以刷新Power Query等数据连接
# sheet.api.QueryTables.Item(1).Refresh()

# 5. 调用现有的VBA宏
# 如果公司有现成的复杂宏,直接调用,不用重写!
wb.macro("GenerateCharts")()  # 执行名为 GenerateCharts 的宏

# 6. 最后,保存、关闭、退出
wb.save("刷新后的报表.xlsx")
wb.close()
app.quit()  # 关闭Excel程序

一个真实自动化场景:

每天凌晨2点,Python脚本自动运行:

  1. 从数据库拉取最新销售数据。
  2. 用pandas清洗计算。
  3. 用xlsxwriter生成包含图表的初步报表。
  4. 用xlwings打开报表,刷新其中的透视表和外部数据链接。
  5. 将最终报表保存为PDF,并发送邮件给相关领导。

从此,你不再是做报表的人,你是设计报表流水线的人。


性能实战:处理百万行数据,如何不卡死?

当Excel文件变成“巨无霸”,常规方法就失灵了。下面是几条救命的实战经验:

策略一:从源头解决,用.xlsb格式

如果数据源你能控制,强烈要求导出为 .xlsb(Excel二进制格式)。它比.xlsx小很多,读取速度快2-3倍

# pandas 读取 .xlsb 需要 pyxlsb 引擎
# 先安装:pip install pyxlsb
df = pd.read_excel("data.xlsb", engine="pyxlsb")

策略二:精准读取,不要全盘照收

用pandas的usecolsnrows参数,只读取你需要的列和行,内存占用立竿见影。

# 一个100列的文件,我可能只关心其中5列
df = pd.read_excel("huge.xlsx",
                   usecols=["订单号""日期""金额""客户""产品"],
                   nrows=500000)  # 只读前50万行

策略三:化整为零,分块处理(终极方案)

如果文件实在太大,内存装不下,就用“分块读取,逐块处理”的策略。

import openpyxl

wb = openpyxl.load_workbook("巨型文件.xlsx", read_only=True)
ws = wb.active
chunk_size = 10000# 每1万行处理一次
chunk = []

for i, row in enumerate(ws.iter_rows(values_only=True), start=1):
    chunk.append(row)
if i % chunk_size == 0:  # 攒够1万行
        process_chunk(chunk)  # 你的处理函数
        chunk = []            # 清空,准备下一块
        print(f"已处理 {i} 行...")

# 处理最后剩下的不足1万行的数据
if chunk:
    process_chunk(chunk)

wb.close()

策略四:写入优化,减少保存次数

用openpyxl时,切记把所有修改都做完,最后只保存一次。在循环里频繁save(),会慢到让你怀疑人生。


三大“组合拳”,覆盖90%实际工作场景

最后,分享三个我总结的高频工作流模板,直接复制修改就能用。

组合拳一:多文件合并分析报告

(每天合并几十个分公司报表的同学,请熟读并背诵)

import pandas as pd
from pathlib import Path
from openpyxl import load_workbook
from openpyxl.styles import PatternFill, Font

# 1. 用Pandas合并文件夹下所有Excel
all_dfs = []
for file_path in Path("./每日报表").glob("*.xlsx"):  # 找到所有xlsx文件
    df = pd.read_excel(file_path)
    df["数据来源"] = file_path.stem  # 新增一列,记录是哪个分公司的数据
    all_dfs.append(df)

merged_df = pd.concat(all_dfs, ignore_index=True)  # 合并成一个大的DataFrame

# 2. 数据分析
summary_df = merged_df.groupby("地区").agg(
    销售总额=("销售额""sum"),
    平均客单价=("销售额""mean"),
    订单数=("订单号""nunique")
).reset_index()

# 3. 写入Excel(原始数据+汇总结果)
with pd.ExcelWriter("全国销售汇总.xlsx", engine="openpyxl"as writer:
    merged_df.to_excel(writer, sheet_name="明细数据", index=False)
    summary_df.to_excel(writer, sheet_name="地区汇总", index=False)

# 4. 用Openpyxl美化格式
wb = load_workbook("全国销售汇总.xlsx")
for sheet_name in ["明细数据""地区汇总"]:
    ws = wb[sheet_name]
    blue_fill = PatternFill(start_color="2F5496", fill_type="solid")
    white_font = Font(bold=True, color="FFFFFF")
for cell in ws[1]:  # 美化第一行表头
        cell.fill = blue_fill
        cell.font = white_font

wb.save("全国销售汇总_美化版.xlsx")
print("合并、分析、美化,一键完成!")

组合拳二:数据清洗标准化流水线

(对付来源混乱、格式不一的数据,这是你的“消毒水”)

defclean_excel_data(input_path, output_path):
"""
    一站式数据清洗函数:去重、删空、规范格式、过滤异常。
    """

    df = pd.read_excel(input_path)

    cleaned_df = (df
                  .drop_duplicates()  # 去重
                  .dropna(subset=["订单号""金额"])  # 关键字段不能为空
                  .assign(
# 规范日期格式
                      下单日期=lambda x: pd.to_datetime(x["下单日期"], errors="coerce"),
# 金额不能为负
                      金额=lambda x: x["金额"].clip(lower=0),
# 手机号去掉所有空格
                      联系电话=lambda x: x["联系电话"].astype(str).str.replace(r"\s+""", regex=True)
                  )
                  .query("下单日期.notna()")  # 删除日期格式错误的行
                 )

    cleaned_df.to_excel(output_path, index=False)
return cleaned_df

# 使用
clean_data = clean_excel_data("原始乱数据.xlsx""清洗后标准数据.xlsx")

组合拳三:按条件拆分数据到不同文件

(比如按地区、按月份,把总表拆给不同负责人)

df = pd.read_excel("全体客户数据.xlsx")

# 按“所属省份”拆分,每个省存一个单独的Excel文件
for province, group_df in df.groupby("所属省份"):
    safe_name = str(province).replace("/""-").replace("\\""-")[:31]  # 处理非法字符,并限制长度
    group_df.to_excel(f"客户数据_{safe_name}.xlsx", index=False)
    print(f"已生成: 客户数据_{safe_name}.xlsx")

回顾一下:

  • pandas 是你的数据分析大脑,处理数据又快又强。
  • openpyxl 是你的格式美容师,精修单元格样样在行。
  • xlsxwriter 是你的高速印刷机,生成新报表速度称王。
  • xlwings 是你的遥控器,让Excel软件自己动起来。

没有哪个库是完美的,但可把它们组合起来使用。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-02 23:32:45 HTTP/2.0 GET : https://f.mffb.com.cn/a/502537.html
  2. 运行时间 : 0.115970s [ 吞吐率:8.62req/s ] 内存消耗:4,852.31kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=d9d80adc774ecfb3c5b8b21e566a0836
  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.000939s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001432s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000602s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000585s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001194s ]
  6. SELECT * FROM `set` [ RunTime:0.000494s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001361s ]
  8. SELECT * FROM `article` WHERE `id` = 502537 LIMIT 1 [ RunTime:0.001111s ]
  9. UPDATE `article` SET `lasttime` = 1783006365 WHERE `id` = 502537 [ RunTime:0.010096s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000546s ]
  11. SELECT * FROM `article` WHERE `id` < 502537 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001081s ]
  12. SELECT * FROM `article` WHERE `id` > 502537 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.002035s ]
  13. SELECT * FROM `article` WHERE `id` < 502537 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.003444s ]
  14. SELECT * FROM `article` WHERE `id` < 502537 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.003052s ]
  15. SELECT * FROM `article` WHERE `id` < 502537 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.002110s ]
0.119409s