当前位置:首页>python>Python 零基础100天—Day76 Matplotlib 绘图

Python 零基础100天—Day76 Matplotlib 绘图

  • 2026-08-18 23:11:54
Python 零基础100天—Day76 Matplotlib 绘图

🐍 Python Day76:Matplotlib 绘图 — 数据可视化的基石

🕐 预计用时:3-4 小时 | 🎯 目标:掌握折线图、柱状图、散点图、饼图、子图和样式定制


📖 今日目录

  1. Matplotlib 是什么?
  2. 基本概念
  3. 折线图
  4. 柱状图
  5. 散点图
  6. 饼图
  7. 直方图
  8. 箱线图
  9. 子图布局
  10. 样式美化
  11. 今日练习
  12. 今日小结

1. Matplotlib 是什么?

Matplotlib 是 Python 最基础、最强大的绘图库。几乎所有 Python 数据可视化工具(Seaborn、Pandas 绘图、Plotly)都基于它。

# 安装
# pip install matplotlib

# 核心模块
import matplotlib.pyplot as plt  # 绘图用这个
import numpy as np
import pandas as pd

# 支持中文显示(必须设置!)
plt.rcParams['font.sans-serif'] = ['SimHei', 'DejaVu Sans']
plt.rcParams['axes.unicode_minus'] = False  # 负号显示

# 为什么用 Matplotlib?
# Excel 图表:好看但难自动化
# Matplotlib:完全代码控制,可复现,可批量生成,可定制到像素级

⚠️ 中文显示问题(必做!)

Matplotlib 默认不支持中文,必须在代码开头设置字体:
plt.rcParams['font.sans-serif'] = ['SimHei']

如果 SimHei 不可用,尝试:['Microsoft YaHei', 'WenQuanYi Micro Hei', 'Arial Unicode MS']


2. 基本概念

# Matplotlib 的两套 API
# 1. pyplot 接口(简单,类似 MATLAB)→ plt.xxx()
# 2. 面向对象接口(灵活,推荐)→ fig, ax = plt.subplots()

# 两者关系:每个 plt 操作背后都是对 Figure 和 Axes 对象的操作

# 最简示例
import matplotlib.pyplot as plt

plt.plot([1, 2, 3, 4], [1, 4, 9, 16])
plt.title('简单折线图')
plt.xlabel('X 轴')
plt.ylabel('Y 轴')
plt.show()  # 显示图表(Jupyter 中用 %matplotlib inline)

# 面向对象写法(推荐)
fig, ax = plt.subplots()  # 创建 Figure 和 Axes
ax.plot([1, 2, 3, 4], [1, 4, 9, 16])
ax.set_title('简单折线图')
ax.set_xlabel('X 轴')
ax.set_ylabel('Y 轴')
plt.show()
概念
说明
类比
Figure
整个画布
一张白纸
Axes
绘图区域(含坐标轴)
白纸上的一个画框
Axis
坐标轴
画框里的 X/Y 轴
Artist
所有可见元素
画框里的每一个线条、文字

3. 折线图

折线图是最常用的图表——展示数据随时间或顺序的变化趋势。

import matplotlib.pyplot as plt
import numpy as np

# 基础折线图
x = np.linspace(0, 10, 100)
y1 = np.sin(x)
y2 = np.cos(x)

fig, ax = plt.subplots(figsize=(10, 6))  # 10英寸宽,6英寸高

ax.plot(x, y1, label='sin(x)', color='
#07c160', linewidth=2)
ax.plot(x, y2, label='cos(x)', color='#ff6b6b', linewidth=2, linestyle='--')

ax.set_title('三角函数图像', fontsize=16, fontweight='bold')
ax.set_xlabel('x', fontsize=12)
ax.set_ylabel('y', fontsize=12)
ax.legend(fontsize=12)           # 图例
ax.grid(True, alpha=0.3)         # 网格线
ax.set_xlim(0, 10)               # X 轴范围
ax.set_ylim(-1.5, 1.5)           # Y 轴范围

plt.tight_layout()               # 自动调整布局
plt.savefig('sine_cosine.png', dpi=150, bbox_inches='tight')  # 保存图片
plt.show()
# 多条折线对比
months = ['1月', '2月', '3月', '4月', '5月', '6月']
sales_a = [120, 135, 148, 162, 175, 190]
sales_b = [90, 105, 115, 128, 140, 155]

fig, ax = plt.subplots(figsize=(10, 6))

ax.plot(months, sales_a, marker='o', markersize=8, linewidth=2,
        color='#07c160', label='产品A')
ax.plot(months, sales_b, marker='s', markersize=8, linewidth=2,
        color='#ff6b6b', label='产品B')

# 在数据点上标注数值
for i, (a, b) in enumerate(zip(sales_a, sales_b)):
    ax.annotate(str(a), (i, a), textcoords="offset points",
                xytext=(0, 10), ha='center', fontsize=9)
    ax.annotate(str(b), (i, b), textcoords="offset points",
                xytext=(0, -15), ha='center', fontsize=9)

ax.set_title('2026年上半年产品销量对比', fontsize=16)
ax.set_xlabel('月份')
ax.set_ylabel('销量(件)')
ax.legend()
ax.grid(True, alpha=0.3, linestyle='--')

plt.tight_layout()
plt.show()

📋 plot() 常用参数

参数
说明
示例
color
线条颜色
'red'
'#07c160'(0.1,0.5,0.8)
linewidth
线条粗细
2
linestyle
线条样式
'-'
 实线 '--' 虚线 ':' 点线
marker
数据点标记
'o'
 圆 's' 方 '^' 三角 '*' 星
markersize
标记大小
8
label
图例标签
'销量'
alpha
透明度
0.7

4. 柱状图

柱状图适合比较不同类别的数据大小。

# 基础柱状图
categories = ['Python', 'Java', 'JavaScript', 'C++', 'Go']
popularity = [35, 25, 20, 12, 8]

fig, ax = plt.subplots(figsize=(10, 6))

bars = ax.bar(categories, popularity, color=['#07c160', '#ff6b6b', '#ffd93d', '#6bcb77', '#4d96ff'])

# 在柱子顶部标注数值
for bar, val in zip(bars, popularity):
    ax.text(bar.get_x() + bar.get_width()/2, bar.get_height() + 0.5,
            f'{val}%', ha='center', fontsize=11, fontweight='bold')

ax.set_title('2026年编程语言流行度', fontsize=16)
ax.set_ylabel('流行度 (%)')
ax.set_ylim(0, 45)
ax.grid(axis='y', alpha=0.3)

plt.tight_layout()
plt.show()

# 水平柱状图
fig, ax = plt.subplots(figsize=(10, 6))
ax.barh(categories, popularity, color=['#07c160', '#ff6b6b', '#ffd93d', '#6bcb77', '#4d96ff'])
ax.set_xlabel('流行度 (%)')
ax.set_title('2026年编程语言流行度(水平)')
plt.tight_layout()
plt.show()
# 分组柱状图(对比多个维度)
x = np.arange(len(categories))
width = 0.35

fig, ax = plt.subplots(figsize=(12, 6))
popularity_2025 = [30, 28, 22, 14, 6]
popularity_2026 = [35, 25, 20, 12, 8]

bars1 = ax.bar(x - width/2, popularity_2025, width, label='2025', color='#4d96ff')
bars2 = ax.bar(x + width/2, popularity_2026, width, label='2026', color='#07c160')

ax.set_xticks(x)
ax.set_xticklabels(categories)
ax.set_ylabel('流行度 (%)')
ax.set_title('编程语言流行度对比:2025 vs 2026')
ax.legend()
ax.grid(axis='y', alpha=0.3)

plt.tight_layout()
plt.show()

# 堆叠柱状图
fig, ax = plt.subplots(figsize=(12, 6))
q1 = [30, 20, 15, 10, 5]
q2 = [35, 25, 20, 12, 8]

ax.bar(categories, q1, label='Q1', color='#4d96ff')
ax.bar(categories, q2, bottom=q1, label='Q2', color='#07c160')

ax.set_ylabel('销量')
ax.set_title('季度销量堆叠图')
ax.legend()
plt.tight_layout()
plt.show()

5. 散点图

散点图适合展示两个变量之间的关系(相关性)。

# 基础散点图
np.random.seed(42)
x = np.random.randn(100)
y = 2 * x + np.random.randn(100) * 0.5

fig, ax = plt.subplots(figsize=(10, 6))
scatter = ax.scatter(x, y, c=y, cmap='viridis', s=50, alpha=0.7, edgecolors='white')
ax.set_title('散点图:X vs Y', fontsize=16)
ax.set_xlabel('X 值')
ax.set_ylabel('Y 值')
plt.colorbar(scatter, label='Y 值')  # 颜色条
ax.grid(True, alpha=0.3)
plt.tight_layout()
plt.show()

# 气泡图(散点 + 大小)
np.random.seed(42)
x = np.random.randn(50)
y = np.random.randn(50)
sizes = np.random.randint(50, 500, 50)    # 气泡大小
colors = np.random.randn(50)              # 颜色

fig, ax = plt.subplots(figsize=(10, 6))
scatter = ax.scatter(x, y, s=sizes, c=colors, cmap='RdYlGn',
                     alpha=0.6, edgecolors='gray')
ax.set_title('气泡图:大小表示销量,颜色表示利润率')
ax.set_xlabel('广告投入')
ax.set_ylabel('销售额')
plt.colorbar(scatter, label='利润率')
plt.tight_layout()
plt.show()
# 带回归线的散点图
np.random.seed(42)
x = np.random.uniform(10, 50, 50)     # 广告投入
y = 3 * x + 20 + np.random.randn(50) * 15  # 销售额

fig, ax = plt.subplots(figsize=(10, 6))
ax.scatter(x, y, s=60, alpha=0.7, color='#07c160', edgecolors='white', label='数据点')

# 拟合直线
coefficients = np.polyfit(x, y, 1)    # 1次多项式拟合
poly = np.poly1d(coefficients)
x_line = np.linspace(x.min(), x.max(), 100)
ax.plot(x_line, poly(x_line), color='#ff6b6b', linewidth=2, linestyle='--',
        label=f'拟合线: y={coefficients[0]:.1f}x+{coefficients[1]:.1f}')

# 计算 R²
y_pred = poly(x)
ss_res = np.sum((y - y_pred) ** 2)
ss_tot = np.sum((y - np.mean(y)) ** 2)
r_squared = 1 - ss_res / ss_tot
ax.text(0.05, 0.95, f'R² = {r_squared:.3f}', transform=ax.transAxes,
        fontsize=12, verticalalignment='top',
        bbox=dict(boxstyle='round', facecolor='wheat', alpha=0.5))

ax.set_title('广告投入与销售额的相关性', fontsize=16)
ax.set_xlabel('广告投入(万元)')
ax.set_ylabel('销售额(万元)')
ax.legend()
ax.grid(True, alpha=0.3)
plt.tight_layout()
plt.show()

6. 饼图

# 基础饼图
labels = ['Python', 'Java', 'JavaScript', 'C++', '其他']
sizes = [35, 25, 20, 12, 8]
colors = ['#07c160', '#ff6b6b', '#ffd93d', '#4d96ff', '#cccccc']
explode = (0.05, 0, 0, 0, 0)  # Python 突出显示

fig, ax = plt.subplots(figsize=(8, 8))
wedges, texts, autotexts = ax.pie(
    sizes,
    explode=explode,
    labels=labels,
    colors=colors,
    autopct='%1.1f%%',     # 显示百分比
    shadow=True,            # 阴影
    startangle=90,          # 起始角度
    textprops={'fontsize': 12}
)

# 设置百分比文字样式
for autotext in autotexts:
    autotext.set_fontweight('bold')
    autotext.set_color('white')

ax.set_title('编程语言市场份额', fontsize=16, fontweight='bold')
plt.tight_layout()
plt.show()

# 环形图(甜甜圈图)
fig, ax = plt.subplots(figsize=(8, 8))
ax.pie(sizes, labels=labels, colors=colors, autopct='%1.1f%%',
       pctdistance=0.85, wedgeprops=dict(width=0.4))  # width 控制环的宽度

# 中心文字
ax.text(0, 0, '编程语言\n市场份额', ha='center', va='center',
        fontsize=14, fontweight='bold')

ax.set_title('编程语言市场份额(环形图)', fontsize=16)
plt.tight_layout()
plt.show()

7. 直方图

直方图展示数据的分布情况——哪些值出现频率高,哪些低。

# 正态分布直方图
np.random.seed(42)
data = np.random.normal(170, 8, 1000)  # 身高:均值170cm,标准差8cm

fig, ax = plt.subplots(figsize=(10, 6))
ax.hist(data, bins=30, color='#07c160', edgecolor='white', alpha=0.8)

ax.axvline(np.mean(data), color='red', linestyle='--', linewidth=2,
           label=f'均值: {np.mean(data):.1f}cm')
ax.axvline(np.median(data), color='blue', linestyle='--', linewidth=2,
           label=f'中位数: {np.median(data):.1f}cm')

ax.set_title('1000人身高分布', fontsize=16)
ax.set_xlabel('身高 (cm)')
ax.set_ylabel('频数')
ax.legend()
ax.grid(axis='y', alpha=0.3)
plt.tight_layout()
plt.show()

# 多组对比直方图
np.random.seed(42)
male = np.random.normal(175, 7, 500)
female = np.random.normal(162, 6, 500)

fig, ax = plt.subplots(figsize=(10, 6))
ax.hist(male, bins=30, alpha=0.6, color='#4d96ff', label='男性', edgecolor='white')
ax.hist(female, bins=30, alpha=0.6, color='#ff6b6b', label='女性', edgecolor='white')
ax.set_title('男女身高分布对比', fontsize=16)
ax.set_xlabel('身高 (cm)')
ax.set_ylabel('频数')
ax.legend()
ax.grid(axis='y', alpha=0.3)
plt.tight_layout()
plt.show()

8. 箱线图

# 箱线图:展示数据的五数概括(最小值、Q1、中位数、Q3、最大值)
np.random.seed(42)
data = {
    'Python': np.random.normal(85, 10, 50),
    'Java': np.random.normal(78, 15, 50),
    'JavaScript': np.random.normal(82, 12, 50),
    'C++': np.random.normal(70, 20, 50),
}

fig, ax = plt.subplots(figsize=(10, 6))
bp = ax.boxplot(data.values(), labels=data.keys(), patch_artist=True)

# 设置颜色
colors = ['#07c160', '#ff6b6b', '#ffd93d', '#4d96ff']
for patch, color in zip(bp['boxes'], colors):
    patch.set_facecolor(color)
    patch.set_alpha(0.7)

# 标注中位数
for median in bp['medians']:
    median.set_color('red')
    median.set_linewidth(2)

ax.set_title('各语言考试成绩分布', fontsize=16)
ax.set_ylabel('成绩')
ax.grid(axis='y', alpha=0.3)
plt.tight_layout()
plt.show()

# 箱线图各部分含义:
# 箱子中间的红线 = 中位数(50%分位数)
# 箱子的上下边 = Q1(25%)和 Q3(75%)
# 箱子的高度 = IQR = Q3 - Q1(四分位距)
# 上下须线 = Q3 + 1.5*IQR 和 Q1 - 1.5*IQR
# 圆点 = 离群值(超出须线的数据点)

💡 箱线图怎么看?

• 箱子高 → 数据分散(方差大)
• 箱子矮 → 数据集中(方差小)
• 中位线偏上 → 左偏分布(多数人成绩高)
• 中位线偏下 → 右偏分布(多数人成绩低)
• 圆点多 → 离群值多,数据质量需要关注


9. 子图布局

# 方法1:plt.subplots() 创建网格
fig, axes = plt.subplots(2, 2, figsize=(12, 10))  # 2行2列

# 左上:折线图
x = np.linspace(0, 10, 100)
axes[0, 0].plot(x, np.sin(x), color='#07c160')
axes[0, 0].set_title('正弦函数')
axes[0, 0].grid(True, alpha=0.3)

# 右上:柱状图
categories = ['A', 'B', 'C', 'D']
values = [23, 45, 12, 67]
axes[0, 1].bar(categories, values, color='#ff6b6b')
axes[0, 1].set_title('柱状图')

# 左下:散点图
axes[1, 0].scatter(np.random.randn(50), np.random.randn(50), color='#4d96ff')
axes[1, 0].set_title('散点图')

# 右下:饼图
axes[1, 1].pie([30, 25, 20, 25], labels=['A', 'B', 'C', 'D'], autopct='%1.0f%%')
axes[1, 1].set_title('饼图')

fig.suptitle('四种图表对比', fontsize=18, fontweight='bold')
plt.tight_layout()
plt.show()

# 方法2:不规则布局(GridSpec)
from matplotlib.gridspec import GridSpec

fig = plt.figure(figsize=(14, 6))
gs = GridSpec(1, 3, figure=fig)

# 左边大图占 2 列
ax1 = fig.add_subplot(gs[0, 0:2])
ax1.plot(x, np.sin(x), color='#07c160', linewidth=2)
ax1.set_title('大图:折线图')

# 右边小图
ax2 = fig.add_subplot(gs[0, 2])
ax2.bar(categories, values, color='#ff6b6b')
ax2.set_title('小图:柱状图')

plt.tight_layout()
plt.show()

10. 样式美化

# === 内置样式(一行代码变好看)===
plt.style.use('seaborn-v0_8')     # Seaborn 风格
# plt.style.use('ggplot')          # R 语言 ggplot 风格
# plt.style.use('dark_background') # 暗色背景
# plt.style.use('fivethirtyeight') # 新闻网站风格

# 查看所有可用样式
print(plt.style.available)

# === 自定义颜色方案 ===
COLORS = {
    'primary': '#07c160',    # 微信绿
    'danger': '#ff6b6b',     # 红色
    'warning': '#ffd93d',    # 黄色
    'info': '#4d96ff',       # 蓝色
    'gray': '#888888',
}

# === 全局样式设置 ===
plt.rcParams.update({
    'figure.figsize': (10, 6),
    'figure.dpi': 100,
    'font.size': 12,
    'axes.titlesize': 16,
    'axes.labelsize': 12,
    'axes.grid': True,
    'grid.alpha': 0.3,
    'lines.linewidth': 2,
    'lines.markersize': 6,
})

# === 保存高质量图片 ===
# PNG 格式(适合网页)
plt.savefig('chart.png', dpi=150, bbox_inches='tight', facecolor='white')

# PDF 格式(适合论文)
plt.savefig('chart.pdf', bbox_inches='tight')

# SVG 格式(矢量图,放大不失真)
plt.savefig('chart.svg', bbox_inches='tight')

# === 清除和关闭 ===
plt.clf()     # 清除当前图形
plt.close()   # 关闭图形窗口(释放内存)
plt.close('all')  # 关闭所有窗口

💡 专业图表的 5 个要素:

1. 标题:让人一眼知道图表在说什么
2. 轴标签:X 轴和 Y 轴分别代表什么
3. 图例:多条线/多种颜色时必须有
4. 网格线:帮助读数,但不要太抢眼(alpha=0.3)
5. 数据标注:关键数据点直接标注数值


11. 今日练习

🏋️ 练习 1:销售趋势图

# 创建 12 个月的销售数据,画折线图:
# - 两条线(线上/线下)
# - 标注最高点和最低点
# - 添加图例、标题、网格线

🏋️ 练习 2:成绩分析

# 用子图布局(2x2)展示:
# - 左上:成绩直方图
# - 右上:各科箱线图
# - 左下:男女成绩对比柱状图
# - 右下:成绩等级饼图

🏋️ 练习 3:自定义主题

# 创建一个自定义颜色方案,画出一组专业图表:
# - 使用统一的配色(5种颜色)
# - 设置全局字体和大小
# - 保存为 PNG 和 PDF

12. 今日小结

图表类型
适用场景
核心函数
折线图
趋势变化(时间序列)
ax.plot()
柱状图
类别比较
ax.bar()
 / ax.barh()
散点图
两变量关系(相关性)
ax.scatter()
饼图
占比分布
ax.pie()
直方图
数据分布
ax.hist()
箱线图
五数概括、异常值
ax.boxplot()
子图
多图组合展示
fig, axes = plt.subplots()

🚀 明日预告:Day 77 — Seaborn 可视化

Matplotlib 功能强大但代码量多。Seaborn 在它之上封装了更高级的 API——一行代码画出漂亮的分布图、热力图、分类图。数据分析师的首选可视化工具!

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-08-21 15:49:55 HTTP/2.0 GET : https://f.mffb.com.cn/a/509802.html
  2. 运行时间 : 0.284793s [ 吞吐率:3.51req/s ] 内存消耗:4,600.91kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=d8c35559b95b1208af3bbbaf20efe1d7
  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.000943s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001647s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.001172s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.001386s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001467s ]
  6. SELECT * FROM `set` [ RunTime:0.000572s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001471s ]
  8. SELECT * FROM `article` WHERE `id` = 509802 LIMIT 1 [ RunTime:0.001062s ]
  9. UPDATE `article` SET `lasttime` = 1787298595 WHERE `id` = 509802 [ RunTime:0.005204s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.008350s ]
  11. SELECT * FROM `article` WHERE `id` < 509802 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001296s ]
  12. SELECT * FROM `article` WHERE `id` > 509802 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.020234s ]
  13. SELECT * FROM `article` WHERE `id` < 509802 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.008136s ]
  14. SELECT * FROM `article` WHERE `id` < 509802 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.011549s ]
  15. SELECT * FROM `article` WHERE `id` < 509802 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.040576s ]
0.288479s