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

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

  • 2026-07-02 16:30:26
Python 零基础100天—Day50 综合练习

🐍 Python Day50:综合练习 — 个人记账本(Flask + SQLite)

🕐 预计用时:3-4 小时 | 🎯 目标:用 Flask + SQLAlchemy + SQLite 构建完整 Web 应用


📖 今日目录

  1. 项目需求分析
  2. 技术选型与架构
  3. 数据库模型设计
  4. Flask 应用搭建
  5. 路由与视图函数
  6. HTML 表单与模板
  7. 添加记录功能
  8. 查询与统计功能
  9. 删除与编辑功能
  10. 完整代码
  11. 今日小结

1. 项目需求分析

构建一个简易的个人记账本 Web 应用。

功能
说明
技术
添加记录
记录金额、类别、备注
HTML 表单 + POST
查看列表
按时间排序显示所有记录
SQLAlchemy 查询
分类统计
按类别统计支出
GROUP BY 聚合
月度报表
某月的收支总览
日期过滤 + 统计
删除记录
删除错误的记录
DELETE 操作
编辑记录
修改已有记录
UPDATE 操作

2. 技术选型与架构

# 项目结构
# expense-tracker/
# ├── app.py          # Flask 主应用
# ├── models.py       # 数据库模型
# ├── templates/      # HTML 模板
# │   ├── base.html
# │   ├── index.html
# │   ├── add.html
# │   └── stats.html
# └── static/         # 静态文件(CSS)
#     └── style.css

# 依赖安装
# pip install flask sqlalchemy

3. 数据库模型设计

# models.py
from sqlalchemy import Column, Integer, String, Float, Date, DateTime, create_engine
from sqlalchemy.orm import declarative_base, sessionmaker
from datetime import datetime, date

Base = declarative_base()
engine = create_engine("sqlite:///expense.db", echo=False)
Session = sessionmaker(bind=engine)

class Expense(Base):
    """支出记录"""
    __tablename__ = "expenses"

    id = Column(Integer, primary_key=True, autoincrement=True)
    amount = Column(Float, nullable=False)          # 金额
    category = Column(String(50), nullable=False)    # 类别
    note = Column(String(200))                       # 备注
    date = Column(Date, default=date.today)          # 日期
    type = Column(String(10), default="expense")     # income/expense
    created_at = Column(DateTime, default=datetime.now)

    def __repr__(self):
        return f"<Expense({self.category}: ¥{self.amount})>"

Base.metadata.create_all(engine)

4. Flask 应用搭建

# app.py
from flask import Flask, render_template, request, redirect, url_for
from models import Session, Expense
from datetime import date, datetime
from sqlalchemy import func

app = Flask(__name__)

@app.route("/")
def index():
    """首页:显示所有记录"""
    with Session() as db:
        expenses = db.query(Expense).order_by(Expense.date.desc()).all()

        # 统计
        total_income = db.query(func.sum(Expense.amount)).filter(
            Expense.type == "income"
        ).scalar() or 0
        total_expense = db.query(func.sum(Expense.amount)).filter(
            Expense.type == "expense"
        ).scalar() or 0

        return render_template("index.html",
            expenses=expenses,
            total_income=total_income,
            total_expense=total_expense,
            balance=total_income - total_expense
        )

if __name__ == "__main__":
    app.run(debug=True, port=5000)

5. 路由与视图函数

# app.py(续)

@app.route("/add", methods=["GET", "POST"])
def add():
    """添加记录"""
    if request.method == "POST":
        amount = float(request.form["amount"])
        category = request.form["category"]
        note = request.form.get("note", "")
        record_date = request.form.get("date", date.today().isoformat())
        record_type = request.form.get("type", "expense")

        with Session() as db:
            expense = Expense(
                amount=amount,
                category=category,
                note=note,
                date=datetime.strptime(record_date, "%Y-%m-%d").date(),
                type=record_type
            )
            db.add(expense)
            db.commit()

        return redirect(url_for("index"))

    return render_template("add.html")

@app.route("/delete/<int:id>")
def delete(id):
    """删除记录"""
    with Session() as db:
        expense = db.query(Expense).get(id)
        if expense:
            db.delete(expense)
            db.commit()
    return redirect(url_for("index"))

@app.route("/edit/<int:id>", methods=["GET", "POST"])
def edit(id):
    """编辑记录"""
    with Session() as db:
        expense = db.query(Expense).get(id)
        if not expense:
            return redirect(url_for("index"))

        if request.method == "POST":
            expense.amount = float(request.form["amount"])
            expense.category = request.form["category"]
            expense.note = request.form.get("note", "")
            expense.date = datetime.strptime(request.form["date"], "%Y-%m-%d").date()
            expense.type = request.form.get("type", "expense")
            db.commit()
            return redirect(url_for("index"))

        return render_template("edit.html", expense=expense)

@app.route("/stats")
def stats():
    """统计页面"""
    with Session() as db:
        # 按类别统计支出
        category_stats = db.query(
            Expense.category,
            func.sum(Expense.amount).label("total"),
            func.count(Expense.id).label("count")
        ).filter(
            Expense.type == "expense"
        ).group_by(Expense.category).order_by(
            func.sum(Expense.amount).desc()
        ).all()

        # 按月统计
        month_stats = db.query(
            func.strftime("%Y-%m", Expense.date).label("month"),
            func.sum(Expense.amount).label("total"),
            Expense.type
        ).group_by(
            func.strftime("%Y-%m", Expense.date),
            Expense.type
        ).order_by("month").all()

        return render_template("stats.html",
            category_stats=category_stats,
            month_stats=month_stats
        )

6. HTML 表单与模板

<!-- templates/base.html -->
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>{% block title %}个人记账本{% endblock %}</title>
    <style>
        body { font-family: sans-serif; max-width: 800px; margin: 0 auto; padding: 20px; }
        .nav { background: 
#07c160; padding: 10px 20px; margin-bottom: 20px; border-radius: 8px; }
        .nav a { color: white; text-decoration: none; margin-right: 20px; }
        table { width: 100%; border-collapse: collapse; }
        th { background: #07c160; color: white; padding: 10px; }
        td { padding: 8px; border: 1px solid #ddd; }
        .income { color: green; } .expense { color: red; }
        .btn { padding: 6px 12px; border: none; border-radius: 4px; cursor: pointer; }
        .btn-add { background: #07c160; color: white; }
        .btn-del { background: #ff4d4f; color: white; }
        form label { display: block; margin: 8px 0 4px; }
        form input, form select, form textarea { width: 100%; padding: 8px; box-sizing: border-box; }
    </style>
</head>
<body>
    <div class="nav">
        <a href="/">📋 记录</a>
        <a href="/add">➕ 添加</a>
        <a href="/stats">📊 统计</a>
    </div>
    {% block content %}{% endblock %}
</body>
</html>
<!-- templates/index.html -->
{% extends "base.html" %}
{% block content %}
<h1>💰 个人记账本</h1>

<div style="display:flex;gap:20px;margin:20px 0">
  <div style="flex:1;background:#f0f7f0;padding:16px;border-radius:8px">
    <h3>收入</h3><p class="income">¥{{ "%.2f"|format(total_income) }}</p>
  </div>
  <div style="flex:1;background:#fff2f0;padding:16px;border-radius:8px">
    <h3>支出</h3><p class="expense">¥{{ "%.2f"|format(total_expense) }}</p>
  </div>
  <div style="flex:1;background:#e6f7ff;padding:16px;border-radius:8px">
    <h3>结余</h3><p>¥{{ "%.2f"|format(balance) }}</p>
  </div>
</div>

<a href="/add" class="btn btn-add">➕ 添加记录</a>

<table>
<tr><th>日期</th><th>类别</th><th>金额</th><th>备注</th><th>操作</th></tr>
{% for e in expenses %}
<tr>
  <td>{{ e.date }}</td>
  <td>{{ e.category }}</td>
  <td class="{{ e.type }}">{{ '收入' if e.type == 'income' else '支出' }} ¥{{ "%.2f"|format(e.amount) }}</td>
  <td>{{ e.note or '-' }}</td>
  <td>
    <a href="/edit/{{ e.id }}">✏️</a>
    <a href="/delete/{{ e.id }}" class="btn-del" onclick="return confirm('确定删除?')">🗑️</a>
  </td>
</tr>
{% endfor %}
</table>
{% endblock %}
<!-- templates/add.html -->
{% extends "base.html" %}
{% block title %}添加记录{% endblock %}
{% block content %}
<h1>➕ 添加记录</h1>
<form method="POST">
  <label>类型</label>
  <select name="type">
    <option value="expense">支出</option>
    <option value="income">收入</option>
  </select>

  <label>金额</label>
  <input type="number" name="amount" step="0.01" required>

  <label>类别</label>
  <select name="category">
    <option>餐饮</option><option>交通</option><option>购物</option>
    <option>娱乐</option><option>住房</option><option>医疗</option>
    <option>教育</option><option>工资</option><option>其他</option>
  </select>

  <label>日期</label>
  <input type="date" name="date" value="{{ today }}">

  <label>备注</label>
  <textarea name="note" rows="2"></textarea>

  <button type="submit" class="btn btn-add" style="margin-top:16px;width:100%">保存</button>
</form>
{% endblock %}

7. 添加记录功能

# 已在路由部分实现
# /add 路由处理 GET(显示表单)和 POST(保存数据)

@app.route("/add", methods=["GET", "POST"])
def add():
    if request.method == "POST":
        # 获取表单数据
        amount = float(request.form["amount"])
        category = request.form["category"]
        note = request.form.get("note", "")
        record_date = request.form.get("date", date.today().isoformat())
        record_type = request.form.get("type", "expense")

        # 保存到数据库
        with Session() as db:
            expense = Expense(
                amount=amount, category=category, note=note,
                date=datetime.strptime(record_date, "%Y-%m-%d").date(),
                type=record_type
            )
            db.add(expense)
            db.commit()

        return redirect(url_for("index"))

    return render_template("add.html", today=date.today().isoformat())

8. 查询与统计功能

@app.route("/stats")
def stats():
    with Session() as db:
        # 按类别统计
        category_stats = db.query(
            Expense.category,
            func.sum(Expense.amount).label("total"),
            func.count(Expense.id).label("count")
        ).filter(Expense.type == "expense"
        ).group_by(Expense.category
        ).order_by(func.sum(Expense.amount).desc()).all()

        # 本月统计
        today = date.today()
        month_start = today.replace(day=1)
        month_total = db.query(func.sum(Expense.amount)).filter(
            Expense.date >= month_start,
            Expense.type == "expense"
        ).scalar() or 0

        month_income = db.query(func.sum(Expense.amount)).filter(
            Expense.date >= month_start,
            Expense.type == "income"
        ).scalar() or 0

        return render_template("stats.html",
            category_stats=category_stats,
            month_expense=month_total,
            month_income=month_income,
            month_balance=month_income - month_total
        )

# templates/stats.html
# {% extends "base.html" %}
# {% block content %}
# <h1>📊 统计分析</h1>
# <h2>本月概览</h2>
# <p>收入: ¥{{ month_income }} | 支出: ¥{{ month_expense }} | 结余: ¥{{ month_balance }}</p>
# <h2>分类支出</h2>
# <table>
# <tr><th>类别</th><th>金额</th><th>笔数</th></tr>
# {% for cat, total, count in category_stats %}
# <tr><td>{{ cat }}</td><td>¥{{ "%.2f"|format(total) }}</td><td>{{ count }}</td></tr>
# {% endfor %}
# </table>
# {% endblock %}

9. 完整代码

"""
个人记账本 - 完整 app.py
依赖: pip install flask sqlalchemy
运行: python app.py → http://localhost:5000
"""
from flask import Flask, render_template, request, redirect, url_for
from sqlalchemy import Column, Integer, String, Float, Date, DateTime, func, create_engine
from sqlalchemy.orm import declarative_base, sessionmaker
from datetime import datetime, date

app = Flask(__name__)
Base = declarative_base()
engine = create_engine("sqlite:///expense.db")
Session = sessionmaker(bind=engine)

class Expense(Base):
    __tablename__ = "expenses"
    id = Column(Integer, primary_key=True)
    amount = Column(Float, nullable=False)
    category = Column(String(50), nullable=False)
    note = Column(String(200))
    date = Column(Date, default=date.today)
    type = Column(String(10), default="expense")
    created_at = Column(DateTime, default=datetime.now)

Base.metadata.create_all(engine)

@app.route("/")
def index():
    with Session() as db:
        expenses = db.query(Expense).order_by(Expense.date.desc()).all()
        income = db.query(func.sum(Expense.amount)).filter(Expense.type == "income").scalar() or 0
        expense = db.query(func.sum(Expense.amount)).filter(Expense.type == "expense").scalar() or 0
        return render_template("index.html", expenses=expenses,
            total_income=income, total_expense=expense, balance=income - expense)

@app.route("/add", methods=["GET", "POST"])
def add():
    if request.method == "POST":
        with Session() as db:
            e = Expense(
                amount=float(request.form["amount"]),
                category=request.form["category"],
                note=request.form.get("note", ""),
                date=datetime.strptime(request.form.get("date", date.today().isoformat()), "%Y-%m-%d").date(),
                type=request.form.get("type", "expense")
            )
            db.add(e); db.commit()
        return redirect(url_for("index"))
    return render_template("add.html", today=date.today().isoformat())

@app.route("/delete/<int:id>")
def delete(id):
    with Session() as db:
        e = db.query(Expense).get(id)
        if e: db.delete(e); db.commit()
    return redirect(url_for("index"))

@app.route("/stats")
def stats():
    with Session() as db:
        cat_stats = db.query(Expense.category, func.sum(Expense.amount), func.count(Expense.id)
            ).filter(Expense.type == "expense").group_by(Expense.category
            ).order_by(func.sum(Expense.amount).desc()).all()
        return render_template("stats.html", category_stats=cat_stats)

if __name__ == "__main__":
    app.run(debug=True)

10. 今日小结

项目知识串联

功能
用到的技术
来源
数据模型
SQLAlchemy ORM
Day48-49
数据库操作
CRUD、聚合查询
Day45-46
Web 框架
Flask 路由、模板
Day51(预告)
HTML 表单
form、input、select
Day67(预告)
日期处理
datetime、date
Day30
数据库
SQLite
Day45-46

🎯 扩展练习:
1. 添加"预算"功能——设置每月预算,超支时提醒
2. 添加"导入/导出"功能——支持 CSV 格式
3. 添加"图表"功能——用 matplotlib 生成饼图/柱状图
4. 添加"多用户"支持——登录注册 + 每人独立账本


📚 Day50 完成!第二阶段(Python 进阶)全部结束 ✅
🎉 恭喜完成半程!明天进入第三阶段:Web 开发 — Flask 框架入门

轻松时刻:

请在微信客户端打开

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-03 01:02:18 HTTP/2.0 GET : https://f.mffb.com.cn/a/502883.html
  2. 运行时间 : 0.707833s [ 吞吐率:1.41req/s ] 内存消耗:4,513.27kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=e9fe29f36f7ef43cc1bb6dd214196cf6
  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.000580s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000773s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.003519s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.010345s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000740s ]
  6. SELECT * FROM `set` [ RunTime:0.009187s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000720s ]
  8. SELECT * FROM `article` WHERE `id` = 502883 LIMIT 1 [ RunTime:0.076497s ]
  9. UPDATE `article` SET `lasttime` = 1783011738 WHERE `id` = 502883 [ RunTime:0.009995s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.006924s ]
  11. SELECT * FROM `article` WHERE `id` < 502883 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.016962s ]
  12. SELECT * FROM `article` WHERE `id` > 502883 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.071775s ]
  13. SELECT * FROM `article` WHERE `id` < 502883 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.175530s ]
  14. SELECT * FROM `article` WHERE `id` < 502883 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.166878s ]
  15. SELECT * FROM `article` WHERE `id` < 502883 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.074391s ]
0.710347s