当前位置:首页>python>Python 零基础100天—Day88 综合练习

Python 零基础100天—Day88 综合练习

  • 2026-08-23 22:53:24
Python 零基础100天—Day88 综合练习

🐍 Python Day88:综合练习 — 房价预测项目全流程

🕐 预计用时:4-5 小时 | 🎯 目标:走完一个完整的机器学习项目——数据探索 → 特征工程 → 模型训练 → 评估 → 预测


📖 今日目录

  1. 项目概述
  2. 数据加载与探索
  3. 数据清洗
  4. 特征工程
  5. 模型训练
  6. 模型评估
  7. 模型调优
  8. 最终预测
  9. 今日小结

1. 项目概述

今天我们做一件"正经事"——从头到尾完成一个真实的机器学习项目

任务:根据房屋的各种属性(面积、卧室数、地段、年份等),预测房价。

完整流程:

┌──────────┐   ┌──────────┐   ┌──────────┐   ┌──────────┐
│ 数据加载  │ → │ 数据探索  │ → │ 数据清洗  │ → │ 特征工程  │
└──────────┘   └──────────┘   └──────────┘   └──────────┘
                                                    ↓
┌──────────┐   ┌──────────┐   ┌──────────┐   ┌──────────┐
│ 最终预测  │ ← │ 模型调优  │ ← │ 模型评估  │ ← │ 模型训练  │
└──────────┘   └──────────┘   └──────────┘   └──────────┘

2. 数据加载与探索

2.1 生成真实感数据

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings('ignore')

np.random.seed(42)
n = 1000

# 生成房屋数据
data = {
    '面积': np.random.lognormal(mean=4.5, sigma=0.4, size=n).astype(int).clip(30, 500),
    '卧室数': np.random.choice([1, 2, 3, 4, 5], size=n, p=[0.1, 0.25, 0.35, 0.2, 0.1]),
    '楼层': np.random.randint(1, 33, n),
    '总楼层': np.random.choice([6, 11, 18, 26, 33], size=n, p=[0.2, 0.25, 0.25, 0.2, 0.1]),
    '房龄': np.random.exponential(10, n).astype(int).clip(0, 30),
    '装修': np.random.choice(['毛坯', '简装', '精装', '豪装'], size=n, p=[0.15, 0.35, 0.35, 0.15]),
    '朝向': np.random.choice(['东', '南', '西', '北', '南北通透'], size=n, p=[0.1, 0.3, 0.1, 0.1, 0.4]),
    '有电梯': np.random.choice([0, 1], size=n, p=[0.3, 0.7]),
    '学区': np.random.choice([0, 1], size=n, p=[0.6, 0.4]),
    '地铁距离_km': np.random.exponential(1.5, n).round(2),
}

# 计算房价(带噪声的模拟公式)
price = (
    data['面积'] * 2.8
    + data['卧室数'] * 15
    - data['房龄'] * 3
    + data['有电梯'] * 30
    + data['学区'] * 50
    - data['地铁距离_km'] * 10
    + np.where(data['装修'] == '豪装', 40, np.where(data['装修'] == '精装', 20, 0))
    + np.where(data['朝向'] == '南北通透', 15, 0)
    + np.random.randn(n) * 20
)

data['房价_万'] = price.clip(50, 2000).round(1)
df = pd.DataFrame(data)

print(f"数据集: {df.shape[0]} 行 × {df.shape[1]} 列")
print(f"\n前5行:")
print(df.head())

2.2 数据探索

# 基本统计
print("=" * 60)
print("数据概况")
print("=" * 60)
print(f"样本数: {len(df)}")
print(f"特征数: {df.shape[1] - 1}")
print(f"\n房价统计:")
print(df['房价_万'].describe().round(1))

# 数据类型
print(f"\n数据类型:")
for col in df.columns:
    dtype = df[col].dtype
    nunique = df[col].nunique()
    print(f"  {col:>12s}: {str(dtype):>8s}  唯一值: {nunique}")

2.3 可视化探索

fig, axes = plt.subplots(2, 3, figsize=(16, 10))

# 1. 房价分布
axes[0, 0].hist(df['房价_万'], bins=30, color='
#07c160', alpha=0.7, edgecolor='white')
axes[0, 0].set_xlabel('房价 (万元)')
axes[0, 0].set_ylabel('频次')
axes[0, 0].set_title('房价分布')
axes[0, 0].axvline(df['房价_万'].mean(), color='red', linestyle='--', label=f"均值: {df['房价_万'].mean():.0f}万")
axes[0, 0].legend()

# 2. 面积 vs 房价
axes[0, 1].scatter(df['面积'], df['房价_万'], alpha=0.3, s=10, color='#1890ff')
axes[0, 1].set_xlabel('面积 (㎡)')
axes[0, 1].set_ylabel('房价 (万元)')
axes[0, 1].set_title('面积 vs 房价')

# 3. 卧室数 vs 房价
df.boxplot(column='房价_万', by='卧室数', ax=axes[0, 2])
axes[0, 2].set_xlabel('卧室数')
axes[0, 2].set_ylabel('房价 (万元)')
axes[0, 2].set_title('卧室数 vs 房价')

# 4. 装修 vs 房价
df.boxplot(column='房价_万', by='装修', ax=axes[1, 0])
axes[1, 0].set_xlabel('装修')
axes[1, 0].set_ylabel('房价 (万元)')
axes[1, 0].set_title('装修 vs 房价')

# 5. 学区 vs 房价
df.boxplot(column='房价_万', by='学区', ax=axes[1, 1])
axes[1, 1].set_xlabel('学区 (0=否, 1=是)')
axes[1, 1].set_ylabel('房价 (万元)')
axes[1, 1].set_title('学区 vs 房价')

# 6. 地铁距离 vs 房价
axes[1, 2].scatter(df['地铁距离_km'], df['房价_万'], alpha=0.3, s=10, color='#722ed1')
axes[1, 2].set_xlabel('地铁距离 (km)')
axes[1, 2].set_ylabel('房价 (万元)')
axes[1, 2].set_title('地铁距离 vs 房价')

plt.suptitle('房价数据探索', fontsize=16, fontweight='bold')
plt.tight_layout()
plt.savefig('eda_plots.png', dpi=150)
plt.show()

2.4 相关性分析

# 只看数值列的相关性
numeric_cols = df.select_dtypes(include=[np.number]).columns
corr = df[numeric_cols].corr()['房价_万'].sort_values(ascending=False)
print("与房价的相关性:")
for col, val in corr.items():
    if col != '房价_万':
        bar = "█" * int(abs(val) * 20)
        sign = "+" if val > 0 else "-"
        print(f"  {col:>15s}: {sign}{abs(val):.3f} {bar}")

# 相关性热力图(需要先安装:pip install seaborn)
import seaborn as sns
plt.figure(figsize=(10, 8))
sns.heatmap(df[numeric_cols].corr(), annot=True, fmt='.2f', cmap='RdYlGn', center=0)
plt.title('特征相关性热力图')
plt.tight_layout()
plt.savefig('correlation_heatmap.png', dpi=150)
plt.show()

3. 数据清洗

# 检查缺失值
print("缺失值统计:")
missing = df.isnull().sum()
print(missing[missing > 0] if missing.sum() > 0 else "  ✅ 无缺失值")

# 检查异常值
print("\n异常值检查:")
for col in ['面积', '房价_万', '地铁距离_km']:
    Q1 = df[col].quantile(0.25)
    Q3 = df[col].quantile(0.75)
    IQR = Q3 - Q1
    lower = Q1 - 1.5 * IQR
    upper = Q3 + 1.5 * IQR
    outliers = ((df[col] < lower) | (df[col] > upper)).sum()
    print(f"  {col}: {outliers} 个异常值 (范围: {lower:.1f} ~ {upper:.1f})")

# 删除异常值(可选)
df_clean = df[
    (df['面积'] >= 30) & (df['面积'] <= 500) &
    (df['房价_万'] >= 50) & (df['房价_万'] <= 2000)
].copy()
print(f"\n清洗后: {len(df_clean)} 行 (删除了 {len(df) - len(df_clean)} 行)")

4. 特征工程

特征工程是机器学习中最花时间但最重要的环节。好的特征 = 好的模型。

4.1 编码分类特征

from sklearn.preprocessing import LabelEncoder

# 装修:有序编码(毛坯 < 简装 < 精装 < 豪装)
装修顺序 = {'毛坯': 0, '简装': 1, '精装': 2, '豪装': 3}
df_clean['装修_编码'] = df_clean['装修'].map(装修顺序)

# 朝向:独热编码
朝向_dummies = pd.get_dummies(df_clean['朝向'], prefix='朝向')
df_clean = pd.concat([df_clean, 朝向_dummies], axis=1)

print("编码后新增列:")
print(df_clean.columns.tolist()[-6:])

4.2 特征衍生

# 创建新特征
df_clean['单价'] = df_clean['房价_万'] / df_clean['面积']  # 每平米价格
df_clean['楼层比'] = df_clean['楼层'] / df_clean['总楼层']  # 楼层位置
df_clean['是否高层'] = (df_clean['楼层'] > df_clean['总楼层'] * 0.7).astype(int)
df_clean['面积_卧室比'] = df_clean['面积'] / df_clean['卧室数']  # 每间卧室面积

print("衍生特征:")
print(df_clean[['面积', '卧室数', '楼层', '总楼层', '楼层比', '是否高层', '面积_卧室比']].head())

🚫 数据泄露警告:上面的 单价 = 房价 / 面积 用到了目标变量 房价_万千万不能把它作为预测特征!否则模型等于"用答案猜答案",训练时 R² 接近 1.0,上线后完全失效。后续 feature_cols 中已排除该特征。记住:衍生特征只能用非目标信息(如面积、楼层等)。

4.3 选择最终特征

# 选择用于建模的特征
feature_cols = [
    '面积', '卧室数', '楼层', '总楼层', '房龄', '有电梯', '学区', '地铁距离_km',
    '装修_编码', '楼层比', '是否高层', '面积_卧室比',
    '朝向_东', '朝向_南', '朝向_西', '朝向_北', '朝向_南北通透'
]

X = df_clean[feature_cols]
y = df_clean['房价_万']

print(f"特征矩阵: {X.shape}")
print(f"目标变量: {y.shape}")

5. 模型训练

from sklearn.model_selection import train_test_split, cross_val_score
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LinearRegression, Ridge, Lasso
from sklearn.tree import DecisionTreeRegressor
from sklearn.ensemble import RandomForestRegressor, GradientBoostingRegressor
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score

# 拆分数据
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# 标准化
scaler = StandardScaler()
X_train_scaled = scaler.fit_transform(X_train)
X_test_scaled = scaler.transform(X_test)

print(f"训练集: {X_train_scaled.shape[0]} 样本")
print(f"测试集: {X_test_scaled.shape[0]} 样本")

# ========== 训练多个模型对比 ==========
models = {
    '线性回归': LinearRegression(),
    'Ridge回归': Ridge(alpha=1.0),
    'Lasso回归': Lasso(alpha=1.0),
    '决策树(depth=5)': DecisionTreeRegressor(max_depth=5, random_state=42),
    '决策树(depth=10)': DecisionTreeRegressor(max_depth=10, random_state=42),
    '随机森林(100)': RandomForestRegressor(n_estimators=100, random_state=42),
    '梯度提升(100)': GradientBoostingRegressor(n_estimators=100, random_state=42),
}

print("\n" + "=" * 70)
print(f"{'模型':>20s} | {'R²':>8s} | {'RMSE':>10s} | {'MAE':>10s}")
print("-" * 70)

results = {}
for name, model in models.items():
    model.fit(X_train_scaled, y_train)
    y_pred = model.predict(X_test_scaled)

    r2 = r2_score(y_test, y_pred)
    rmse = np.sqrt(mean_squared_error(y_test, y_pred))
    mae = mean_absolute_error(y_test, y_pred)

    results[name] = {'r2': r2, 'rmse': rmse, 'mae': mae, 'model': model}
    print(f"{name:>20s} | {r2:>7.4f} | {rmse:>9.2f} | {mae:>9.2f}")

print("=" * 70)

best_name = max(results, key=lambda k: results[k]['r2'])
print(f"\n🏆 最佳模型: {best_name} (R² = {results[best_name]['r2']:.4f})")

6. 模型评估

6.1 预测 vs 真实值散点图

# 用最佳模型预测
best_model = results[best_name]['model']
y_pred = best_model.predict(X_test_scaled)

fig, axes = plt.subplots(1, 2, figsize=(14, 5))

# 散点图
axes[0].scatter(y_test, y_pred, alpha=0.4, s=15, color='#07c160')
min_val = min(y_test.min(), y_pred.min())
max_val = max(y_test.max(), y_pred.max())
axes[0].plot([min_val, max_val], [min_val, max_val], 'r--', linewidth=2)
axes[0].set_xlabel('真实房价 (万元)')
axes[0].set_ylabel('预测房价 (万元)')
axes[0].set_title(f'{best_name} — 真实 vs 预测 (R²={results[best_name]["r2"]:.4f})')

# 残差图
residuals = y_test.values - y_pred
axes[1].scatter(y_pred, residuals, alpha=0.4, s=15, color='#1890ff')
axes[1].axhline(y=0, color='r', linestyle='--')
axes[1].set_xlabel('预测房价 (万元)')
axes[1].set_ylabel('残差 (万元)')
axes[1].set_title('残差分布')

plt.tight_layout()
plt.savefig('model_evaluation.png', dpi=150)
plt.show()

6.2 特征重要性

# 随机森林的特征重要性
if hasattr(best_model, 'feature_importances_'):
    importances = best_model.feature_importances_
    sorted_idx = np.argsort(importances)[::-1]

    plt.figure(figsize=(10, 6))
    plt.barh(range(len(feature_cols)), importances[sorted_idx], color='#07c160')
    plt.yticks(range(len(feature_cols)), [feature_cols[i] for i in sorted_idx])
    plt.xlabel('重要性')
    plt.title(f'{best_name} — 特征重要性')
    plt.gca().invert_yaxis()
    plt.tight_layout()
    plt.savefig('feature_importance.png', dpi=150)
    plt.show()

    print("特征重要性排名:")
    for i, idx in enumerate(sorted_idx):
        print(f"  {i+1}. {feature_cols[idx]}: {importances[idx]:.4f}")

7. 模型调优

7.1 网格搜索

from sklearn.model_selection import GridSearchCV

# 对随机森林进行网格搜索
param_grid = {
    'n_estimators': [50, 100, 200],
    'max_depth': [5, 10, 15, None],
    'min_samples_split': [2, 5, 10],
}

rf = RandomForestRegressor(random_state=42)
grid_search = GridSearchCV(rf, param_grid, cv=5, scoring='r2', n_jobs=-1, verbose=1)
grid_search.fit(X_train_scaled, y_train)

print(f"\n最佳参数: {grid_search.best_params_}")
print(f"最佳 R² (交叉验证): {grid_search.best_score_:.4f}")

# 用最佳参数评估测试集
best_rf = grid_search.best_estimator_
y_pred_tuned = best_rf.predict(X_test_scaled)
r2_tuned = r2_score(y_test, y_pred_tuned)
rmse_tuned = np.sqrt(mean_squared_error(y_test, y_pred_tuned))
print(f"测试集 R²: {r2_tuned:.4f}")
print(f"测试集 RMSE: {rmse_tuned:.2f} 万元")

7.2 学习曲线

from sklearn.model_selection import learning_curve

train_sizes, train_scores, val_scores = learning_curve(
    best_rf, X_train_scaled, y_train,
    train_sizes=np.linspace(0.1, 1.0, 10),
    cv=5, scoring='r2', n_jobs=-1
)

plt.figure(figsize=(10, 6))
plt.plot(train_sizes, train_scores.mean(axis=1), 'o-', color='#07c160', label='训练集')
plt.plot(train_sizes, val_scores.mean(axis=1), 'o-', color='#1890ff', label='验证集')
plt.fill_between(train_sizes,
                 train_scores.mean(axis=1) - train_scores.std(axis=1),
                 train_scores.mean(axis=1) + train_scores.std(axis=1), alpha=0.1, color='#07c160')
plt.fill_between(train_sizes,
                 val_scores.mean(axis=1) - val_scores.std(axis=1),
                 val_scores.mean(axis=1) + val_scores.std(axis=1), alpha=0.1, color='#1890ff')
plt.xlabel('训练样本数')
plt.ylabel('R² 分数')
plt.title('学习曲线')
plt.legend()
plt.grid(True, alpha=0.3)
plt.tight_layout()
plt.savefig('learning_curve.png', dpi=150)
plt.show()

8. 最终预测

# 用调优后的模型做实际预测
new_houses = pd.DataFrame({
    '面积': [89, 120, 150, 200, 65],
    '卧室数': [2, 3, 3, 4, 1],
    '楼层': [15, 8, 22, 5, 30],
    '总楼层': [33, 18, 33, 6, 33],
    '房龄': [3, 10, 5, 20, 1],
    '有电梯': [1, 1, 1, 0, 1],
    '学区': [1, 0, 1, 0, 0],
    '地铁距离_km': [0.3, 1.2, 0.5, 2.0, 0.1],
    '装修_编码': [2, 1, 3, 1, 2],  # 精装/简装/豪装/简装/精装
    '楼层比': [15/33, 8/18, 22/33, 5/6, 30/33],
    '是否高层': [0, 0, 1, 0, 1],
    '面积_卧室比': [89/2, 120/3, 150/3, 200/4, 65/1],
    '朝向_东': [0, 0, 0, 0, 0],
    '朝向_南': [0, 0, 0, 0, 1],
    '朝向_西': [0, 0, 0, 0, 0],
    '朝向_北': [0, 0, 0, 0, 0],
    '朝向_南北通透': [1, 1, 1, 1, 0],
})

new_scaled = scaler.transform(new_houses)
predictions = best_rf.predict(new_scaled)

print("=" * 65)
print("🏠 房价预测结果")
print("=" * 65)
descs = ['89㎡ 2室 精装 学区房', '120㎡ 3室 简装', '150㎡ 3室 豪装 学区房',
         '200㎡ 4室 简装 老房', '65㎡ 1室 精装 地铁口']
for i, (desc, pred) in enumerate(zip(descs, predictions)):
    print(f"  房子{i+1}: {desc}")
    print(f"         → 预测房价: {pred:.1f} 万元")
print("=" * 65)

9. 今日小结

步骤
做了什么
关键工具
数据探索
统计、可视化、相关性
pandas, matplotlib, seaborn
数据清洗
缺失值、异常值处理
pandas, IQR
特征工程
编码、衍生、选择
LabelEncoder, get_dummies
模型训练
7种模型对比
sklearn 各种回归器
模型评估
R²、RMSE、残差分析
sklearn.metrics
模型调优
网格搜索、学习曲线
GridSearchCV
最终预测
新数据预测
best_estimator_

🎯 一句话总结:机器学习项目的 80% 时间花在数据处理和特征工程上,真正训练模型只占 20%。好数据比好算法更重要!

🔮 明天预告:Day89 我们将跳出数据科学,学习设计模式——写出更优雅、更可维护的 Python 代码。单例模式、工厂模式、观察者模式...这些"编程套路"将让你的代码质量上一个台阶!

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-08-24 00:37:37 HTTP/2.0 GET : https://f.mffb.com.cn/a/512009.html
  2. 运行时间 : 0.204755s [ 吞吐率:4.88req/s ] 内存消耗:4,457.60kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=c0d2d3507c70d640fa9f7a0870abaff9
  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.001218s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001641s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000770s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000665s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001250s ]
  6. SELECT * FROM `set` [ RunTime:0.000557s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001499s ]
  8. SELECT * FROM `article` WHERE `id` = 512009 LIMIT 1 [ RunTime:0.001051s ]
  9. UPDATE `article` SET `lasttime` = 1787503058 WHERE `id` = 512009 [ RunTime:0.010927s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000578s ]
  11. SELECT * FROM `article` WHERE `id` < 512009 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001130s ]
  12. SELECT * FROM `article` WHERE `id` > 512009 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000965s ]
  13. SELECT * FROM `article` WHERE `id` < 512009 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.001906s ]
  14. SELECT * FROM `article` WHERE `id` < 512009 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.003570s ]
  15. SELECT * FROM `article` WHERE `id` < 512009 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.003930s ]
0.208652s