跳到内容
当前位置:首页>Excel>pandas 导出 Excel 美化实战:多 Sheet、颜色与条件格式

pandas 导出 Excel 美化实战:多 Sheet、颜色与条件格式

  • 2026-11-08 02:33:15
pandas 导出 Excel 美化实战:多 Sheet、颜色与条件格式

DataFrame.to_excel() 能把数据写入 Excel,但它给出的东西本质上是一张"裸表":没有列宽、没有千分位、负数不会标红等等,总之没有做其他更多的处理。作为报表,这是不够的。

这篇文章从工程实践角度,把 pandas 导出 Excel 的美化拆成四层:多 Sheet 组织 → 静态样式 → 动态条件格式 → 性能与踩坑。所有代码都可直接复制运行。

一、使用的技术

pandas 的 ExcelWriter 支持两种引擎,能力边界完全不同:

引擎
强项
短板
openpyxl
可读写、样式 API 完整、能修改已有文件
大文件慢,条件格式 API 略啰嗦
xlsxwriter
性能好、条件格式/图表/迷你图 API 极其顺手
只能新建,不能读取已有文件

结论:要"精雕细琢 + 追加写入"用 openpyxl;要"百万行 + 花式条件格式"用 xlsxwriter。 下面两条路线都会给完整代码。

依赖安装:

pip install pandas numpy openpyxl xlsxwriter

二、多 Sheet 写入的三种方式

方式 1:一次 writer,多次 to_excel(最常用)

import pandas as pdwith pd.ExcelWriter("out.xlsx", engine="openpyxl")as writer:    summary.to_excel(writer, sheet_name="区域汇总", index=False)    detail.to_excel(writer, sheet_name="销售明细", index=False)

注意 with 是必须的——不退出上下文,文件可能不会完整写入磁盘。

方式 2:追加到已有文件(pandas ≥ 1.3)

with pd.ExcelWriter("out.xlsx", engine="openpyxl",  mode="a",# 追加模式  if_sheet_exists="replace",# 同名 sheet 覆盖,可选 "new" / "overlay") as writer:    new_df.to_excel(writer, sheet_name="本周新增", index=False)

mode="a" 时 writer.book 是已加载的旧工作簿,你照样可以在上面做样式加工。

方式 3:同一 Sheet 内分区摆放(做 Dashboard 很好用)

with pd.ExcelWriter("dashboard.xlsx", engine="openpyxl") as writer:    summary.to_excel(writer, sheet_name="看板",       index=False,startrow=1, startcol=0)     detail.to_excel(writer, sheet_name="看板",       index=False,startrow=len(summary)+4, startcol=0)
startrow / startcol 是 0-based 偏移,配合后面的合并单元格、标题行,就能拼出一个像样的看板页。

⚠️ Sheet 命名规则:不超过 31 字符,且不能包含 [ ] : * ? / \。中文没问题,但带斜杠的部门名(如"华东/上海")会直接抛异常,写个 str.replace() 清洗一下。

三、openpyxl 路线:完整可运行脚本

下面这份脚本包含:造数据 → 多 Sheet 写入 → 表头主题色 → 斑马纹 → 数字格式 → 冻结窗格 → 自动筛选 → 列宽自适应 → 四类条件格式。

# -*- coding: utf-8 -*-"""pandas → Excel 美化导出(openpyxl 引擎)依赖:pandas numpy openpyxl>=3.0运行:python make_report.py"""from __future__ import annotationsimport numpy as npimport pandas as pdfrom openpyxl.formatting.rule import (    CellIsRule, ColorScaleRule, DataBarRule, FormulaRule,)from openpyxl.styles import Alignment, Border, Font, PatternFill, Sidefrom openpyxl.utils import get_column_letterOUT_PATH = "销售报表.xlsx"# ---------------- 0. 主题常量(改这里就能换肤) ----------------FONT_NAME = "微软雅黑"C_HEADER_BG, C_HEADER_FG = "1F4E78", "FFFFFF"C_BAND = "F2F7FB"          # 斑马纹C_LINE = "D9D9D9"          # 边框线C_BAD_BG, C_BAD_FG = "FFC7CE", "9C0006"C_GOOD_BG, C_GOOD_FG = "C6EFCE", "006100"_SIDE = Side(style="thin", color=C_LINE)BORDER = Border(left=_SIDE, right=_SIDE, top=_SIDE, bottom=_SIDE)FONT_HEADER = Font(name=FONT_NAME, size=10, bold=True, color=C_HEADER_FG)FONT_BODY = Font(name=FONT_NAME, size=10)FILL_HEADER = PatternFill("solid", fgColor=C_HEADER_BG)FILL_BAND = PatternFill("solid", fgColor=C_BAND)FILL_BAD = PatternFill("solid", fgColor=C_BAD_BG)FILL_GOOD = PatternFill("solid", fgColor=C_GOOD_BG)# ---------------- 1. 造一份带亏损的数据 ----------------def make_data(seed: int = 42):    rng = np.random.default_rng(seed)    n = 300    base = pd.Timestamp("2025-01-01")    sales = rng.normal(12000, 4000, n).clip(1500).round(2)    cost = (sales * rng.normal(0.88, 0.16, n)).round(2)   # 会有成本 > 销售额的情况    detail = pd.DataFrame({        "日期": (base + pd.to_timedelta(rng.integers(0, 120, n), unit="D")).date,        "区域": rng.choice(["华东", "华北", "华南", "西南"], n),        "渠道": rng.choice(["线上", "门店", "分销"], n),        "销售额": sales,        "成本": cost,        "订单数": rng.integers(10, 200, n),    })    detail["毛利"] = (detail["销售额"] - detail["成本"]).round(2)    detail["毛利率"] = (detail["毛利"] / detail["销售额"]).round(4)    detail = detail.sort_values("日期").reset_index(drop=True)    summary = (        detail.groupby("区域", as_index=False)        .agg(销售额=("销售额", "sum"), 成本=("成本", "sum"),             订单数=("订单数", "sum"), 毛利=("毛利", "sum"))    )    summary["毛利率"] = (summary["毛利"] / summary["销售额"]).round(4)    summary = summary.sort_values("销售额", ascending=False).reset_index(drop=True)    return detail, summary# ---------------- 2. 静态样式 ----------------def _text_width(value) -> int:    """按 Excel 列宽单位估算显示宽度:CJK 字符算 2"""    return sum(2 if ord(ch) > 0x2E80 else 1 for ch in str(value))def autofit_columns(ws, df, min_width=10, max_width=32, sample=300):    """列宽自适应(Excel 不支持真正的 auto-fit,只能估算)"""    for idx, col in enumerate(df.columns, start=1):        width = _text_width(col)        for v in df[col].head(sample):            width = max(width, _text_width(v))        ws.column_dimensions[get_column_letter(idx)].width = min(            max(width + 3, min_width), max_width        )def style_sheet(ws, df, *, number_formats=None, align_map=None,                freeze="A2", autofilter=True, banded=True,                header_fill=None):    """给一张已经写完数据的 sheet 上样式"""    n_rows, n_cols = len(df), len(df.columns)    number_formats = number_formats or {}    align_map = align_map or {}    cols = list(df.columns)    h_fill = PatternFill("solid", fgColor=header_fill) if header_fill else FILL_HEADER    # --- 表头 ---    for j in range(1, n_cols + 1):        c = ws.cell(row=1, column=j)        c.font, c.fill, c.border = FONT_HEADER, h_fill, BORDER        c.alignment = Alignment(horizontal="center", vertical="center",                                wrap_text=True)    ws.row_dimensions[1].height = 26    # --- 数据区 ---    for i in range(2, n_rows + 2):        ws.row_dimensions[i].height = 17        is_band = banded and i % 2 == 0        for j in range(1, n_cols + 1):            c = ws.cell(row=i, column=j)            c.font, c.border = FONT_BODY, BORDER            c.alignment = Alignment(                horizontal=align_map.get(cols[j - 1], "left"),                vertical="center",            )            if is_band:                c.fill = FILL_BAND    # --- 数字格式 ---    for name, fmt in number_formats.items():        if name not in cols:            continue        j = cols.index(name) + 1        for i in range(2, n_rows + 2):            ws.cell(row=i, column=j).number_format = fmt    autofit_columns(ws, df)    if freeze:        ws.freeze_panes = freeze           # "A2" 冻结首行,"B2" 再冻结首列    if autofilter and n_rows:        ws.auto_filter.ref = f"A1:{get_column_letter(n_cols)}{n_rows + 1}"    ws.sheet_view.showGridLines = False    # 关掉网格线,报表立刻"高级"起来# ---------------- 3. 条件格式 ----------------def _col_range(df, name) -> str:    letter = get_column_letter(list(df.columns).index(name) + 1)    return f"{letter}2:{letter}{len(df) + 1}"def cf_data_bar(ws, df, name, color="638EC6"):    """数据条:一眼看出量级差异"""    ws.conditional_formatting.add(        _col_range(df, name),        DataBarRule(start_type="num", start_value=0, end_type="max",                    color=color, showValue=True),    )def cf_color_scale(ws, df, name, reverse=False):    """三色阶:低红-中黄-高绿"""    lo, mid, hi = "F8696B", "FFEB84", "63BE7B"    if reverse:        lo, hi = hi, lo    ws.conditional_formatting.add(        _col_range(df, name),        ColorScaleRule(            start_type="min", start_color=lo,            mid_type="percentile", mid_value=50, mid_color=mid,            end_type="max", end_color=hi,        ),    )def cf_cell_rule(ws, df, name, operator, value, *, good=False):    """单元格规则:如 毛利 < 0 标红"""    fill = FILL_GOOD if good else FILL_BAD    fg = C_GOOD_FG if good else C_BAD_FG    ws.conditional_formatting.add(        _col_range(df, name),        CellIsRule(operator=operator, formula=[str(value)], fill=fill,                   font=Font(name=FONT_NAME, color=fg, bold=True)),    )def cf_row_formula(ws, df, formula, *, good=False):    """    公式规则:整行高亮。    formula 相对区域左上角 A2 求值,例如 '$G2<0'    """    last = get_column_letter(len(df.columns))    ws.conditional_formatting.add(        f"A2:{last}{len(df) + 1}",        FormulaRule(formula=[formula],                    fill=FILL_GOOD if good else FILL_BAD,                    stopIfTrue=False),    )# ---------------- 4. 主流程 ----------------def build():    detail, summary = make_data()    MONEY = "#,##0.00"    PCT = "0.00%"    with pd.ExcelWriter(OUT_PATH, engine="openpyxl") as writer:        detail.to_excel(writer, sheet_name="销售明细", index=False)        summary.to_excel(writer, sheet_name="区域汇总", index=False)        # ===== 明细页 =====        ws = writer.sheets["销售明细"]        style_sheet(            ws, detail,            number_formats={"销售额": MONEY, "成本": MONEY,                            "毛利": MONEY, "毛利率": PCT},            align_map={"日期": "center", "区域": "center", "渠道": "center",                       "订单数": "right", "销售额": "right", "成本": "right",                       "毛利": "right", "毛利率": "right"},        )        cf_color_scale(ws, detail, "销售额")                 # 销售额三色阶        cf_data_bar(ws, detail, "订单数", color="7FB3D5")    # 订单数数据条        cf_cell_rule(ws, detail, "毛利", "lessThan", 0)      # 负毛利标红        # 整行预警:毛利为负 → 整行淡红        loss_letter = get_column_letter(list(detail.columns).index("毛利") + 1)        cf_row_formula(ws, detail, f"${loss_letter}2<0")        # ===== 汇总页(换个表头色,视觉上区分层级)=====        ws2 = writer.sheets["区域汇总"]        style_sheet(            ws2, summary,            number_formats={"销售额": MONEY, "成本": MONEY,                            "毛利": MONEY, "毛利率": PCT},            align_map={"区域": "center", "订单数": "right", "销售额": "right",                       "成本": "right", "毛利": "right", "毛利率": "right"},            header_fill="2E75B6",        )        cf_data_bar(ws2, summary, "销售额")        cf_color_scale(ws2, summary, "毛利率")        # 把汇总页挪到第一个并设为默认打开页        writer.book.move_sheet("区域汇总", offset=-1)        writer.book.active = 0    print(f"✅ 已生成 {OUT_PATH}")if __name__ == "__main__":    build()

跑完打开文件,你会看到:汇总页在最前、表头深蓝白字、隔行浅蓝、销售额带渐变数据条、毛利率红黄绿色阶、明细页里凡是毛利为负的整行都会泛红。

几个细节注意:

① number_format 是作用在"显示层"上的。0.00% 让 0.1234 显示成 12.34%,单元格里存的仍然是 0.1234,后续在 Excel 里做透视表、算公式完全不受影响。同理 #,##0.00 加千分位。

② 条件格式的颜色必须写 start_color / end_color。 openpyxl 里用 PatternFill("solid", fgColor=...) 也可以,但用 start_color 更保险,因为 Excel 在渲染 differential format 时读的是它。

③ 公式规则里的引用是相对区域左上角。 我们给 A2:H301 加 $G2<0,Excel 会对每一行按行号偏移求值,所以能实现"整行高亮"。列名用 $ 锁死,行号不能锁。

④ 列宽只能估算。 Excel 的列宽单位是"标准字体的字符数",中文字符约占 2 个宽度,所以 _text_width 里用 ord(ch) > 0x2E80 判断。真·auto-fit 只有 Excel 客户端能做到(或者用 xlsxwriter 的 autofit(),它内部也是估算)。

四、xlsxwriter 路线:条件格式更爽、更快

如果你的数据量上了十万行,或者条件格式规则复杂到十几条,换 xlsxwriter。这段代码中的 make_data()是使用前面已经给出的代码中的 make_data()方法。

import pandas as pddetail, summary = make_data()n = len(summary)with pd.ExcelWriter("销售报表_xw.xlsx", engine="xlsxwriter") as writer:    summary.to_excel(writer, sheet_name="区域汇总", index=False)    wb = writer.book    ws = writer.sheets["区域汇总"]    fmt_money = wb.add_format({"num_format": "#,##0.00",                               "font_name": "微软雅黑", "font_size": 10})    fmt_pct = wb.add_format({"num_format": "0.00%",                             "font_name": "微软雅黑", "font_size": 10})    fmt_bad = wb.add_format({"bg_color": "#FFC7CE", "font_color": "#9C0006"})    # 列宽 + 列级数字格式(单元格没格式时自动继承)    ws.set_column("A:A", 10)    ws.set_column("B:C", 16, fmt_money)    ws.set_column("D:D", 10)    ws.set_column("E:E", 16, fmt_money)    ws.set_column("F:F", 12, fmt_pct)    ws.freeze_panes(1, 0)    ws.autofilter(0, 0, n, len(summary.columns) - 1)    # 条件格式:行列均 0-based,(首行, 首列, 末行, 末列)    ws.conditional_format(1, 1, n, 1, {           # 销售额:数据条        "type": "data_bar", "bar_color": "#638EC6", "bar_solid": True,    })    ws.conditional_format(1, 5, n, 5, {           # 毛利率:三色阶        "type": "3_color_scale",        "min_color": "#F8696B", "mid_color": "#FFEB84", "max_color": "#63BE7B",    })    ws.conditional_format(1, 4, n, 4, {           # 毛利 < 0 标红        "type": "cell", "criteria": "<", "value": 0, "format": fmt_bad,    })    ws.conditional_format(1, 0, n, 5, {           # 公式规则:整行高亮        "type": "formula",        "criteria": "=$E2<0",        "format": wb.add_format({"bg_color": "#FFF2CC"}),    })    # xlsxwriter 还白送一堆 openpyxl 要手写的花样    ws.conditional_format(1, 3, n, 3, {"type": "icon_set", "icon_style": "3_arrows"})

xlsxwriter 的优势集中在三点:

  • 规则用 dict 描述,几十种 type(data_bar / 3_color_scale / icon_set / cell / formula / top10 / duplicate / text…),比 openpyxl 的类体系直观太多;

  • icon_set 图标集、add_sparkline 迷你图、add_chart 原生图表,openpyxl 要么不支持要么很难用;

  • {'constant_memory': True} 常量内存模式能把百万行写入的内存占用压到几十 MB:

with pd.ExcelWriter("big.xlsx", engine="xlsxwriter",  engine_kwargs={"options":{"constant_memory":True}},) as writer:    big_df.to_excel(writer, sheet_name="明细", index=False)
代价是它不能读取和修改已有文件,且 constant_memory 模式下必须按行顺序写、不能回头改样式。

五、踩坑清单

写到生产里,下面这些几乎一定会遇到:

  1. sheet_name 非法字符。带 /、: 的名称直接抛 ValueError。统一清洗:re.sub(r"[\[\]:*?/\\]", "-", name)[:31]。

  2. index=False 忘写。默认会把 DataFrame 索引也导出去,多出一列 Unnamed: 0。

  3. 日期列变成文本。如果列里混了 None 和 datetime,pandas 会推成 object,Excel 里就是左对齐的字符串,没法按日期排序。写之前 pd.to_datetime(df["日期"], errors="coerce") 强制一下。

  4. 时区感知的 datetime 无法写入。tz-aware 的 Timestamp 会报错,先 .dt.tz_localize(None)。

  5. 条件格式区域写错。A2:A301 写成 A2:A300 会漏掉最后一行,而且不报错,只是效果不对。用 len(df) + 1 动态算,别硬编码。

  6. openpyxl 写大文件极慢。十万行 × 20 列,openpyxl 逐格设样式可能要几分钟。这种场景要么换 xlsxwriter,要么只给表头加样式、数据区交给 Excel 自带的"套用表格格式"。

  7. 文件被 Excel 占用。PermissionError: [Errno 13] 十有八九是你自己开着那个 xlsx。写入前先检测,或者用时间戳命名输出文件。

  8. 样式对象不要在每个循环里 new。上面代码把 Font、PatternFill 提到模块级复用,十万次循环下能省下可观的 GC 开销。

六、小结

总体上看,其实只有三件事:

  • 结构:一个 ExcelWriter 管多 Sheet,mode="a" 管追加,startrow/startcol 管同页分区;

  • 静态样式:表头色块 + 斑马纹 + 数字格式 + 冻结窗格 + 隐藏网格线,这五件套做完,观感就能从"数据导出"跃迁到"报表";

  • 动态条件格式:色阶看分布,数据条看量级,单元格规则和公式规则做异常预警——注意条件格式是"显示层",不改数据,这一点在做审计留痕时非常重要。

最后一句经验:别一次性把所有美化逻辑写死在业务代码里。 把上面的 style_sheet / cf_* 抽成独立的 excel_style.py,业务侧只负责 df 和"这一页用哪套主题",后面加个新报表就是三行代码的事。

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