当前位置:首页>python>Python机器学习实战:从数据预处理到模型部署

Python机器学习实战:从数据预处理到模型部署

  • 2026-01-18 18:14:00
Python机器学习实战:从数据预处理到模型部署
点击上方“Python爬虫与数据挖掘”,进行关注

回复“书籍”即可获赠Python从入门到进阶共10本电子书

苟利国家生死以,岂因祸福避趋之。——林则徐《赴戍登程口占示家人》

作者:Python进阶者

关键词:机器学习, 数据预处理, 特征工程, 模型训练, 超参数优化, 模型部署, Scikit-learn, TensorFlow

开头引言
机器学习已成为数据驱动决策的核心技术。本文通过一个完整的案例,展示如何使用Python完成从数据准备到模型部署的全流程,帮助你快速掌握机器学习实战技能。

一、数据准备与探索

1.1 数据加载与质量检查

import pandas as pdimport numpy as npimport matplotlib.pyplot as pltimport seaborn as snsfrom sklearn.datasets import load_iris# 加载示例数据defload_and_explore_data():"""数据加载与探索"""# 使用鸢尾花数据集示例    iris = load_iris()    df = pd.DataFrame(iris.data, columns=iris.feature_names)    df['target'] = iris.target    df['species'] = df['target'].map({0'setosa'1'versicolor'2'virginica'})print("=== 数据概览 ===")print(f"数据形状: {df.shape}")print("\n前5行数据:")print(df.head())print("\n基本统计信息:")print(df.describe())print("\n缺失值检查:")print(df.isnull().sum())return df# 数据可视化defvisualize_data(df):"""数据可视化分析"""    fig, axes = plt.subplots(22, figsize=(1210))# 特征分布    df[iris.feature_names].hist(ax=axes[00])    axes[00].set_title('特征分布')# 类别分布    df['species'].value_counts().plot(kind='bar', ax=axes[01])    axes[01].set_title('类别分布')# 散点图    sns.scatterplot(data=df, x='sepal length (cm)', y='sepal width (cm)'                   hue='species', ax=axes[10])    axes[10].set_title('花萼长度 vs 花萼宽度')# 相关性热图    numeric_df = df.select_dtypes(include=[np.number])    sns.heatmap(numeric_df.corr(), annot=True, ax=axes[11])    axes[11].set_title('相关性热图')    plt.tight_layout()    plt.show()# 执行数据探索df = load_and_explore_data()visualize_data(df)

1.2 数据预处理

from sklearn.preprocessing import StandardScaler, LabelEncoderfrom sklearn.model_selection import train_test_splitdefpreprocess_data(df):"""数据预处理流程"""print("=== 数据预处理 ===")# 复制数据避免修改原数据    data = df.copy()# 处理缺失值(示例数据无缺失,展示流程)if data.isnull().sum().sum() > 0:# 数值型用中位数填充        numeric_cols = data.select_dtypes(include=[np.number]).columns        data[numeric_cols] = data[numeric_cols].fillna(data[numeric_cols].median())# 类别型用众数填充        categorical_cols = data.select_dtypes(include=['object']).columnsfor col in categorical_cols:            data[col] = data[col].fillna(data[col].mode()[0ifnot data[col].mode().empty else'Unknown')# 特征工程:创建新特征    data['sepal_ratio'] = data['sepal length (cm)'] / data['sepal width (cm)']    data['petal_ratio'] = data['petal length (cm)'] / data['petal width (cm)']print("创建的新特征:")print(data[['sepal_ratio''petal_ratio']].describe())return datadefprepare_features_target(data, target_col='species'):"""准备特征和目标变量"""# 选择特征    feature_cols = [col for col in data.columns if col notin [target_col, 'target']]    X = data[feature_cols]    y = data[target_col]# 编码目标变量(如果是字符串标签)if y.dtype == 'object':        le = LabelEncoder()        y_encoded = le.fit_transform(y)else:        y_encoded = y# 数据标准化    scaler = StandardScaler()    X_scaled = scaler.fit_transform(X)# 划分训练测试集    X_train, X_test, y_train, y_test = train_test_split(        X_scaled, y_encoded, test_size=0.2, random_state=42, stratify=y_encoded    )print(f"训练集: {X_train.shape}, 测试集: {X_test.shape}")return X_train, X_test, y_train, y_test, scaler, feature_cols# 执行预处理processed_data = preprocess_data(df)X_train, X_test, y_train, y_test, scaler, feature_names = prepare_features_target(processed_data)

二、模型训练与评估

2.1 多种算法比较

from sklearn.linear_model import LogisticRegressionfrom sklearn.ensemble import RandomForestClassifierfrom sklearn.svm import SVCfrom sklearn.neighbors import KNeighborsClassifierfrom sklearn.metrics import classification_report, confusion_matrix, accuracy_scoredeftrain_and_evaluate_models(X_train, X_test, y_train, y_test):"""训练并评估多个模型"""print("=== 模型训练与评估 ===")# 定义模型    models = {'逻辑回归': LogisticRegression(random_state=42, max_iter=1000),'随机森林': RandomForestClassifier(random_state=42, n_estimators=100),'支持向量机': SVC(random_state=42, probability=True),'K近邻': KNeighborsClassifier(n_neighbors=3)    }    results = {}for name, model in models.items():print(f"\n训练 {name}...")# 训练模型        model.fit(X_train, y_train)# 预测        y_pred = model.predict(X_test)        y_pred_proba = model.predict_proba(X_test)# 评估        accuracy = accuracy_score(y_test, y_pred)        report = classification_report(y_test, y_pred)        results[name] = {'model': model,'accuracy': accuracy,'predictions': y_pred,'probabilities': y_pred_proba,'report': report        }print(f"{name} 准确率: {accuracy:.4f}")return resultsdefcompare_models(results):"""比较模型性能"""print("\n=== 模型比较 ===")# 准确率比较    accuracies = {name: result['accuracy'for name, result in results.items()}    best_model = max(accuracies, key=accuracies.get)print("各模型准确率:")for name, accuracy insorted(accuracies.items(), key=lambda x: x[1], reverse=True):print(f"  {name}{accuracy:.4f}")print(f"\n最佳模型: {best_model} (准确率: {accuracies[best_model]:.4f})")# 可视化比较    plt.figure(figsize=(106))    models = list(accuracies.keys())    scores = list(accuracies.values())    bars = plt.bar(models, scores, color=['skyblue''lightcoral''lightgreen''gold'])    plt.title('模型准确率比较')    plt.ylabel('准确率')    plt.ylim(01.0)# 在柱子上添加数值for bar, score inzip(bars, scores):        plt.text(bar.get_x() + bar.get_width()/2, bar.get_height() + 0.01,f'{score:.4f}', ha='center', va='bottom')    plt.xticks(rotation=45)    plt.tight_layout()    plt.show()return best_model# 训练和评估模型model_results = train_and_evaluate_models(X_train, X_test, y_train, y_test)best_model_name = compare_models(model_results)best_model = model_results[best_model_name]['model']

2.2 模型优化

from sklearn.model_selection import GridSearchCVdefoptimize_model(X_train, y_train):"""超参数优化"""print("=== 超参数优化 ===")# 使用随机森林进行优化示例    param_grid = {'n_estimators': [50100200],'max_depth': [357None],'min_samples_split': [2510],'min_samples_leaf': [124]    }    rf = RandomForestClassifier(random_state=42)    grid_search = GridSearchCV(        rf, param_grid, cv=5, scoring='accuracy', n_jobs=-1, verbose=1    )    grid_search.fit(X_train, y_train)print(f"最佳参数: {grid_search.best_params_}")print(f"最佳交叉验证分数: {grid_search.best_score_:.4f}")return grid_search.best_estimator_# 模型优化optimized_model = optimize_model(X_train, y_train)# 评估优化后的模型optimized_accuracy = accuracy_score(y_test, optimized_model.predict(X_test))print(f"优化后模型测试准确率: {optimized_accuracy:.4f}")# 特征重要性分析ifhasattr(optimized_model, 'feature_importances_'):    feature_importance = pd.DataFrame({'feature': feature_names,'importance': optimized_model.feature_importances_    }).sort_values('importance', ascending=False)print("\n特征重要性:")print(feature_importance)# 可视化特征重要性    plt.figure(figsize=(106))    plt.barh(feature_importance['feature'], feature_importance['importance'])    plt.title('特征重要性')    plt.xlabel('重要性')    plt.tight_layout()    plt.show()

三、模型部署与应用

3.1 模型保存与加载

import joblibimport jsonfrom datetime import datetimedefsave_model(model, scaler, feature_names, model_name='iris_classifier'):"""保存模型和相关组件"""print("=== 保存模型 ===")# 创建时间戳    timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")# 保存模型    model_filename = f'{model_name}_{timestamp}.joblib'    joblib.dump(model, model_filename)# 保存预处理对象    preprocessing_filename = f'{model_name}_preprocessing_{timestamp}.joblib'    preprocessing_artifacts = {'scaler': scaler,'feature_names': feature_names,'timestamp': timestamp    }    joblib.dump(preprocessing_artifacts, preprocessing_filename)# 保存模型信息    model_info = {'model_name': model_name,'model_type'type(model).__name__,'features': feature_names,'timestamp': timestamp,'version''1.0.0'    }    info_filename = f'{model_name}_info_{timestamp}.json'withopen(info_filename, 'w'as f:        json.dump(model_info, f, indent=2)print(f"模型保存为: {model_filename}")print(f"预处理对象保存为: {preprocessing_filename}")print(f"模型信息保存为: {info_filename}")return {'model_file': model_filename,'preprocessing_file': preprocessing_filename,'info_file': info_filename    }defload_model(model_files):"""加载模型和相关组件"""print("=== 加载模型 ===")# 加载模型    model = joblib.load(model_files['model_file'])# 加载预处理对象    preprocessing = joblib.load(model_files['preprocessing_file'])# 加载模型信息withopen(model_files['info_file'], 'r'as f:        model_info = json.load(f)print(f"加载模型: {model_info['model_name']}")print(f"模型类型: {model_info['model_type']}")print(f"特征数量: {len(model_info['features'])}")return model, preprocessing, model_info# 保存模型saved_files = save_model(optimized_model, scaler, feature_names)# 加载模型(演示用途)loaded_model, loaded_preprocessing, model_info = load_model(saved_files)

3.2 创建预测API

from flask import Flask, request, jsonifyimport numpy as npdefcreate_prediction_api(model, preprocessing):"""创建预测API"""classPredictionAPI:def__init__(self, model, preprocessing):self.model = modelself.scaler = preprocessing['scaler']self.feature_names = preprocessing['feature_names']defpredict(self, features):"""单个预测"""# 转换为numpy数组并重塑            features_array = np.array(features).reshape(1, -1)# 标准化特征            features_scaled = self.scaler.transform(features_array)# 预测            prediction = self.model.predict(features_scaled)[0]            probability = self.model.predict_proba(features_scaled)[0]return {'prediction'int(prediction),'probabilities': probability.tolist(),'class_mapping': {0'setosa'1'versicolor'2'virginica'}            }defbatch_predict(self, features_list):"""批量预测"""            predictions = []for features in features_list:try:                    result = self.predict(features)                    predictions.append(result)except Exception as e:                    predictions.append({'error'str(e)})return predictions# 创建API实例    api = PredictionAPI(model, preprocessing)# 测试预测print("=== API测试 ===")    test_features = [5.13.51.40.213.57.0]  # 示例特征    result = api.predict(test_features)print("预测结果:")print(f"预测类别: {result['class_mapping'][result['prediction']]}")print(f"各类别概率: {result['probabilities']}")return api# 创建预测APIprediction_api = create_prediction_api(loaded_model, loaded_preprocessing)

3.3 简单的Web应用

defcreate_simple_web_app(api):"""创建简单的Web应用"""    app = Flask(__name__)    @app.route('/')defhome():return'''        <h1>鸢尾花分类器</h1>        <p>使用机器学习模型预测鸢尾花种类</p>        <p>访问 /predict 进行预测</p>        '''    @app.route('/predict', methods=['POST'])defpredict():try:            data = request.get_json()if'features'notin data:return jsonify({'error''缺少features参数'}), 400            features = data['features']iflen(features) != len(api.feature_names):return jsonify({'error'f'特征数量错误,期望{len(api.feature_names)}个特征','expected_features': api.feature_names                }), 400            result = api.predict(features)return jsonify(result)except Exception as e:return jsonify({'error'str(e)}), 500    @app.route('/health', methods=['GET'])defhealth_check():return jsonify({'status''healthy''timestamp': datetime.now().isoformat()})# 生成使用示例代码(不实际运行服务器)    usage_example = '''    # 使用示例:    # import requests    #     # data = {    #     "features": [5.1, 3.5, 1.4, 0.2, 13.5, 7.0]    # }    #     # response = requests.post('http://localhost:5000/predict', json=data)    # print(response.json())    '''print("Web应用代码已生成")print(usage_example)return app# 创建Web应用(演示用途)web_app = create_simple_web_app(prediction_api)# 注意:实际运行需要取消注释下面的代码# if __name__ == '__main__':#     web_app.run(debug=True, host='0.0.0.0', port=5000)

四、模型监控与维护

4.1 性能监控

defsetup_model_monitoring(model, X_test, y_test):"""设置模型监控"""print("=== 模型监控设置 ===")classModelMonitor:def__init__(self, model, baseline_accuracy=0.9):self.model = modelself.baseline_accuracy = baseline_accuracyself.performance_history = []self.prediction_count = 0deflog_prediction(self, features, actual, predicted):"""记录预测结果"""self.prediction_count += 1            is_correct = actual == predicted# 简单的性能跟踪(实际应用中应更复杂)ifself.prediction_count % 100 == 0:  # 每100次预测计算一次准确率                recent_predictions = self.performance_history[-100:] iflen(self.performance_history) >= 100elseself.performance_historyif recent_predictions:                    current_accuracy = sum(p['correct'for p in recent_predictions) / len(recent_predictions)if current_accuracy < self.baseline_accuracy * 0.9:  # 性能下降10%print(f"警告: 模型性能下降! 当前准确率: {current_accuracy:.4f}")            prediction_record = {'timestamp': datetime.now().isoformat(),'features': features,'actual': actual,'predicted': predicted,'correct': is_correct            }self.performance_history.append(prediction_record)return is_correctdefget_performance_metrics(self, window_size=100):"""获取性能指标"""iflen(self.performance_history) == 0:return {'accuracy'0'total_predictions'0}            recent_predictions = self.performance_history[-window_size:]            accuracy = sum(p['correct'for p in recent_predictions) / len(recent_predictions)return {'accuracy': accuracy,'total_predictions'len(self.performance_history),'window_size'len(recent_predictions)            }# 创建监控器    monitor = ModelMonitor(model)# 模拟一些预测记录    y_pred = model.predict(X_test)for i, (actual, predicted) inenumerate(zip(y_test, y_pred)):        features = X_test[i].tolist()        monitor.log_prediction(features, actual, predicted)if i >= 50:  # 只模拟50次break# 检查性能    metrics = monitor.get_performance_metrics()print(f"当前准确率: {metrics['accuracy']:.4f}")print(f"总预测次数: {metrics['total_predictions']}")return monitor# 设置监控model_monitor = setup_model_monitoring(optimized_model, X_test, y_test)

总结

本文通过一个完整的机器学习项目,展示了从数据准备到模型部署的全流程:

关键步骤回顾:

  1. 数据探索与预处理
    • 数据质量检查与可视化
    • 特征工程与标准化
    • 训练测试集划分
  2. 模型训练与优化
    • 多种算法比较
    • 超参数调优
    • 特征重要性分析
  3. 模型部署
    • 模型保存与加载
    • API服务创建
    • Web应用开发
  4. 监控维护
    • 性能监控设置
    • 预测结果跟踪

实践建议:

  • 🎯 从小开始:从简单数据集开始,逐步复杂化
  • 📊 重视数据质量:数据质量决定模型上限
  • 🔄 持续迭代:机器学习是持续改进的过程
  • 📝 文档化:记录每个步骤和决策

扩展学习:

想要进一步深入学习,可以探索:
  • 深度学习模型(神经网络)
  • 自动化机器学习(AutoML)
  • 大数据处理(Spark MLlib)
  • 云平台部署(AWS SageMaker, Azure ML)

互动话题:你在机器学习项目中遇到过哪些挑战?最想了解哪个环节的深入内容?欢迎在评论区分享你的经验!
下一篇预告:《Python数据分析实战:Pandas与NumPy高效数据处理》将深入探索数据清洗、转换、聚合等高级技巧,帮助你成为数据处理专家。

【创作声明】

本文的核心大纲和部分基础内容由AI辅助生成,但包含了大量笔者的个人实践经验、独家案例和深度解读。所有配图均为笔者定制化AI生成/制作。旨在为大家提供最直观易懂的教程。感谢AI工具提升了我的创作效率。转载请注明出处。欢迎分享和关注,获取更多Python技术干货!

【提问补充】温馨提示,大家在群里提问的时候。可以注意下面几点:如果涉及到大文件数据,可以数据脱敏后,发点demo数据来(小文件的意思),然后贴点代码(可以复制的那种),记得发报错截图(截全)。代码不多的话,直接发代码文字即可,代码超过50行这样的话,发个.py文件就行。

大家在学习过程中如果有遇到问题,欢迎随时联系我解决(我的微信:2584914241),应粉丝要求,我创建了一些高质量的Python付费学习交流群和付费接单群,欢迎大家加入我的Python学习交流群和接单群!

小伙伴们,快快用实践一下吧!如果在学习过程中,有遇到任何问题,欢迎加我好友,我拉你进Python学习交流群共同探讨学习。

------------------- End -------------------

往期精彩文章推荐:

欢迎大家点赞,留言,转发,转载,感谢大家的相伴与支持

想加入Python学习群请在后台回复【入群

万水千山总是情,点个【在看】行不行

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-09 15:48:39 HTTP/2.0 GET : https://f.mffb.com.cn/a/462116.html
  2. 运行时间 : 0.191458s [ 吞吐率:5.22req/s ] 内存消耗:4,524.42kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=c44cabbf28faa396e7e1a79a068ae427
  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.000543s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000783s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000282s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000248s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000584s ]
  6. SELECT * FROM `set` [ RunTime:0.000259s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000643s ]
  8. SELECT * FROM `article` WHERE `id` = 462116 LIMIT 1 [ RunTime:0.000625s ]
  9. UPDATE `article` SET `lasttime` = 1770623319 WHERE `id` = 462116 [ RunTime:0.008820s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000438s ]
  11. SELECT * FROM `article` WHERE `id` < 462116 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000654s ]
  12. SELECT * FROM `article` WHERE `id` > 462116 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000434s ]
  13. SELECT * FROM `article` WHERE `id` < 462116 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.000839s ]
  14. SELECT * FROM `article` WHERE `id` < 462116 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.001060s ]
  15. SELECT * FROM `article` WHERE `id` < 462116 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.002121s ]
0.193735s