当前位置:首页>python>Python 零基础100天—Day30 datetime 模块

Python 零基础100天—Day30 datetime 模块

  • 2026-06-28 18:38:40
Python 零基础100天—Day30 datetime 模块

🐍 datetime 模块 — 时间处理不再头疼

🕐 预计用时:2-3 小时 | 🎯 目标:掌握 date/time/datetime/timedelta、格式化、时间戳、时区


📖 今日目录

  1. 为什么需要 datetime?
  2. date 类 — 只有日期
  3. time 类 — 只有时间
  4. datetime 类 — 日期 + 时间
  5. timedelta — 时间差计算
  6. strftime / strptime — 格式化与解析
  7. 时间戳 — 时间的数字表示
  8. 时区处理
  9. 实战:倒计时与年龄计算器
  10. 今日小结

1. 为什么需要 datetime?

datetime 模块是 Python 处理日期和时间的标准库,几乎任何涉及时间的程序都离不开它。

常见场景:

  • 📅 计算两个日期之间差几天
  • ⏰ 倒计时、定时任务
  • 📊 按时间排序、分组统计
  • 📝 日志记录带时间戳
  • 🌍 不同时区的时间转换
# datetime 模块有 5 个核心类
from datetime import date, time, datetime, timedelta, timezone

# 它们的关系:
# date     → 只有年月日         → 2024-01-15
# time     → 只有时分秒         → 14:30:00
# datetime → 年月日 + 时分秒    → 2024-01-15 14:30:00
# timedelta → 时间差(几天几小时)→ 3 days, 2:00:00
# timezone → 时区信息           → UTC+8

2. date 类 — 只有日期

date 表示一个日期:年、月、日。

from datetime import date

# 创建日期
d1 = date(2024, 1, 15)          # 指定年月日
d2 = date.today()               # 今天的日期
d3 = date.fromisoformat("2024-01-15")  # 从 ISO 格式解析

print(d1)        # 2024-01-15
print(d2)        # 2024-01-15(今天的日期)
print(d3)        # 2024-01-15

# 获取年月日
print(d1.year)   # 2024
print(d1.month)  # 1
print(d1.day)    # 15

# 获取星期几(0=周一,6=周日)
print(d1.weekday())     # 0(周一)
print(d1.isoweekday())  # 1(ISO 标准,1=周一)

# 星期几的名称
days = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
print(f"{d1} 是 {days[d1.weekday()]}")  # 2024-01-15 是 周一

date 的运算

from datetime import date, timedelta

d1 = date(2024, 1, 15)
d2 = date(2024, 2, 28)

# 两个日期相减 → 返回 timedelta
diff = d2 - d1
print(diff)           # 44 days, 0:00:00
print(diff.days)      # 44

# 日期 + timedelta → 新日期
d3 = d1 + timedelta(days=30)
print(d3)             # 2024-02-14

# 日期 - timedelta → 新日期
d4 = d2 - timedelta(weeks=2)
print(d4)             # 2024-02-14

# 比较日期
print(d1 < d2)   # True
print(d1 == d2)  # False

3. time 类 — 只有时间

time 表示一个时间:时、分、秒、微秒。

from datetime import time

# 创建时间
t1 = time(14, 30, 0)       # 14:30:00
t2 = time(8, 15, 30, 500)  # 08:15:30.000500(含微秒)

print(t1)         # 14:30:00
print(t2)         # 08:15:30.000500

# 获取时分秒
print(t1.hour)    # 14
print(t1.minute)  # 30
print(t1.second)  # 0

# 时间比较
print(t1 > t2)    # True(14:30 比 08:15 晚)

💡 time 类用得比较少,大多数时候你会直接用 datetime 类,它同时包含日期和时间。


4. datetime 类 — 日期 + 时间

datetime 是最常用的类,同时包含年月日和时分秒。

from datetime import datetime

# 创建 datetime
dt1 = datetime(2024, 1, 15, 14, 30, 0)  # 指定全部
dt2 = datetime.now()                      # 当前时间
dt3 = datetime.today()                    # 同 now()
dt4 = datetime.fromisoformat("2024-01-15T14:30:00")  # ISO 格式

print(dt1)   # 2024-01-15 14:30:00
print(dt2)   # 2024-01-15 14:30:25.123456(含微秒)

# 获取各部分
print(dt1.year)       # 2024
print(dt1.month)      # 1
print(dt1.day)        # 15
print(dt1.hour)       # 14
print(dt1.minute)     # 30
print(dt1.second)     # 0
print(dt1.weekday())  # 0(周一)

只取日期或时间部分

from datetime import datetime

dt = datetime(2024, 1, 15, 14, 30, 0)

# datetime → date(只要日期)
d = dt.date()
print(d)          # 2024-01-15
print(type(d))    # <class 'datetime.date'>

# datetime → time(只要时间)
t = dt.time()
print(t)          # 14:30:00
print(type(t))    # <class 'datetime.time'>

datetime 的运算

from datetime import datetime, timedelta

dt1 = datetime(2024, 1, 15, 14, 30)
dt2 = datetime(2024, 3, 20, 10, 0)

# 相减 → timedelta
diff = dt2 - dt1
print(diff)            # 65 days, 19:30:00
print(diff.days)       # 65
print(diff.seconds)    # 70200(19小时30分钟 = 70200秒)

# 总秒数
print(diff.total_seconds())  # 5687400.0

# 加减 timedelta
dt3 = dt1 + timedelta(days=7, hours=2)
print(dt3)   # 2024-01-22 16:30:00

5. timedelta — 时间差计算

timedelta 表示一段时间间隔,用来做日期的加减运算。

from datetime import timedelta

# 创建 timedelta
td1 = timedelta(days=7)                    # 7 天
td2 = timedelta(hours=3, minutes=30)       # 3 小时 30 分
td3 = timedelta(weeks=2, days=3)           # 2 周 3 天 = 17 天
td4 = timedelta(days=1, seconds=3600)      # 1 天 1 小时

print(td1)  # 7 days, 0:00:00
print(td2)  # 3:30:00
print(td3)  # 17 days, 0:00:00
print(td4)  # 1 day, 1:00:00

# timedelta 的属性
print(td3.days)        # 17(天数)
print(td3.total_seconds())  # 1468800.0(总秒数)

实用计算

from datetime import datetime, timedelta

now = datetime.now()

# 3 天后
three_days_later = now + timedelta(days=3)
print(f"3天后: {three_days_later}")

# 2 小时前
two_hours_ago = now - timedelta(hours=2)
print(f"2小时前: {two_hours_ago}")

# 下周一
days_until_monday = (7 - now.weekday()) % 7
if days_until_monday == 0:
    days_until_monday = 7
next_monday = now + timedelta(days=days_until_monday)
print(f"下周一: {next_monday.date()}")

# 30 天前是几号
thirty_days_ago = now - timedelta(days=30)
print(f"30天前: {thirty_days_ago.date()}")

# 100 天后是星期几
days = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
hundred_days_later = now + timedelta(days=100)
print(f"100天后: {hundred_days_later.date()} {days[hundred_days_later.weekday()]}")

💡 timedelta 万能公式:
• 未来 = 现在 + timedelta(参数)
• 过去 = 现在 - timedelta(参数)
• 间隔 = 日期A - 日期B → timedelta


6. strftime / strptime — 格式化与解析

strftime = string format time(格式化输出)
strptime = string parse time(解析字符串)

strftime — datetime → 字符串

from datetime import datetime

now = datetime.now()

# 常用格式化
print(now.strftime("%Y-%m-%d"))           # 2024-01-15
print(now.strftime("%Y/%m/%d %H:%M:%S"))  # 2024/01/15 14:30:25
print(now.strftime("%Y年%m月%d日"))        # 2024年01月15日
print(now.strftime("%H:%M"))              # 14:30
print(now.strftime("%Y-%m-%d %H:%M:%S"))  # 2024-01-15 14:30:25

# 中文格式
weekdays = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
print(f"{now.strftime('%Y年%m月%d日')} {weekdays[now.weekday()]}")
# 2024年01月15日 周一

常用格式符速查

格式符
含义
示例
%Y
四位年份
2024
%m
两位月份(01-12)
01
%d
两位日期(01-31)
15
%H
24小时制小时(00-23)
14
%I
12小时制小时(01-12)
02
%M
分钟(00-59)
30
%S
秒(00-59)
25
%p
AM/PM
PM
%A
星期全称
Monday
%a
星期简称
Mon
%B
月份全称
January
%b
月份简称
Jan
%w
星期数字(0=周日)
1
%j
年中第几天
015
%W
年中第几周
03

strptime — 字符串 → datetime

from datetime import datetime

# 从字符串解析
dt1 = datetime.strptime("2024-01-15", "%Y-%m-%d")
print(dt1)         # 2024-01-15 00:00:00
print(type(dt1))   # <class 'datetime.datetime'>

dt2 = datetime.strptime("2024/01/15 14:30:00", "%Y/%m/%d %H:%M:%S")
print(dt2)         # 2024-01-15 14:30:00

dt3 = datetime.strptime("15-01-2024", "%d-%m-%Y")
print(dt3)         # 2024-01-15 00:00:00

# 常见日期格式
formats = [
    ("2024-01-15", "%Y-%m-%d"),
    ("2024/01/15", "%Y/%m/%d"),
    ("Jan 15, 2024", "%b %d, %Y"),
    ("15-Jan-2024", "%d-%b-%Y"),
    ("20240115", "%Y%m%d"),
]

for text, fmt in formats:
    dt = datetime.strptime(text, fmt)
    print(f"'{text}' → {dt}")

⚠️ strptime 的格式必须严格匹配!
datetime.strptime("2024-1-15", "%Y-%m-%d") → ❌ ValueError
月份必须是两位:"2024-01-15" → ✅


7. 时间戳 — 时间的数字表示

时间戳(timestamp)是从 1970-01-01 00:00:00 UTC 到现在的总秒数,是计算机存储时间的标准方式。

from datetime import datetime

now = datetime.now()

# datetime → 时间戳
ts = now.timestamp()
print(ts)          # 1705312225.123456(浮点数)

# 时间戳 → datetime
dt = datetime.fromtimestamp(ts)
print(dt)          # 2024-01-15 14:30:25.123456

# 时间戳 → UTC datetime
dt_utc = datetime.utcfromtimestamp(ts)
print(dt_utc)      # 2024-01-15 06:30:25.123456(UTC 时间)

为什么时间戳很重要?

from datetime import datetime
import time

# 1. 精确计算时间差
start = time.time()

# 模拟耗时操作
total = 0
for i in range(1000000):
    total += i

elapsed = time.time() - start
print(f"循环耗时: {elapsed:.4f} 秒")  # 循环耗时: 0.0523 秒

# 2. 文件修改时间
import os
mtime = os.path.getmtime("students.csv")
dt = datetime.fromtimestamp(mtime)
print(f"students.csv 最后修改: {dt}")

# 3. 当前时间戳(用于 API 请求等)
print(int(time.time()))  # 1705312225

8. 时区处理

时区是时间处理中最容易出错的部分。Python 用 timezone 和 tzinfo 来处理。

from datetime import datetime, timezone, timedelta

now = datetime.now()
print(f"本地时间(无时区信息): {now}")

# 创建带时区的时间
utc = datetime.now(timezone.utc)
print(f"UTC 时间: {utc}")

# 手动创建时区
tz_shanghai = timezone(timedelta(hours=8))   # UTC+8
tz_tokyo = timezone(timedelta(hours=9))      # UTC+9
tz_new_york = timezone(timedelta(hours=-5))  # UTC-5

# 带时区的时间
dt_shanghai = datetime(2024, 1, 15, 14, 30, tzinfo=tz_shanghai)
print(f"上海: {dt_shanghai}")
# 上海: 2024-01-15 14:30:00+08:00

# 转换时区
dt_tokyo = dt_shanghai.astimezone(tz_tokyo)
print(f"东京: {dt_tokyo}")
# 东京: 2024-01-15 15:30:00+09:00(东京比上海快1小时)

dt_ny = dt_shanghai.astimezone(tz_new_york)
print(f"纽约: {dt_ny}")
# 纽约: 2024-01-15 01:30:00-05:00(纽约比上海慢13小时)

用 zoneinfo 处理标准时区(Python 3.9+)

from datetime import datetime
from zoneinfo import ZoneInfo

# 标准时区名称
beijing = ZoneInfo("Asia/Shanghai")
tokyo = ZoneInfo("Asia/Tokyo")
new_york = ZoneInfo("America/New_York")
london = ZoneInfo("Europe/London")

# 当前各时区时间
now = datetime.now(beijing)
print(f"北京: {now.strftime('%Y-%m-%d %H:%M')}")

now_tokyo = now.astimezone(tokyo)
print(f"东京: {now_tokyo.strftime('%Y-%m-%d %H:%M')}")

now_ny = now.astimezone(new_york)
print(f"纽约: {now_ny.strftime('%Y-%m-%d %H:%M')}")

now_lon = now.astimezone(london)
print(f"伦敦: {now_lon.strftime('%Y-%m-%d %H:%M')}")

💡 时区最佳实践:
1. 存储时间用 UTC(datetime.now(timezone.utc)
2. 显示时间再转本地时区
3. 用 ZoneInfo("Asia/Shanghai") 而不是 timedelta(hours=8)(会自动处理夏令时)


9. 实战:倒计时与年龄计算器

倒计时器

from datetime import datetime, timedelta

def countdown(target_date_str, target_name):
    """计算距离目标日期还有多久"""
    target = datetime.strptime(target_date_str, "%Y-%m-%d")
    now = datetime.now()

    if target < now:
        print(f"❌ {target_name} 已经过去了!")
        return

    diff = target - now
    days = diff.days
    hours, remainder = divmod(diff.seconds, 3600)
    minutes, seconds = divmod(remainder, 60)

    print(f"⏳ 距离 {target_name} 还有:")
    print(f"   {days} 天 {hours} 小时 {minutes} 分钟 {seconds} 秒")

# 使用
countdown("2025-01-01", "元旦")
# ⏳ 距离 元旦 还有:
#    351 天 9 小时 29 分钟 35 秒

countdown("2025-02-01", "春节")
countdown("2025-10-01", "国庆节")

年龄计算器

from datetime import date

def calculate_age(birth_date_str):
    """计算精确年龄"""
    birth = date.fromisoformat(birth_date_str)
    today = date.today()

    # 基本年龄
    age = today.year - birth.year

    # 如果今年生日还没到,减 1
    if (today.month, today.day) < (birth.month, birth.day):
        age -= 1

    # 距离下一个生日
    next_birthday = date(today.year, birth.month, birth.day)
    if next_birthday < today:
        next_birthday = date(today.year + 1, birth.month, birth.day)

    days_until = (next_birthday - today).days

    print(f"🎂 出生日期: {birth}")
    print(f"📅 今天日期: {today}")
    print(f"👤 年龄: {age} 岁")
    print(f"⏳ 距离下一个生日: {days_until} 天")

    return age

# 使用
calculate_age("1995-06-15")
# 🎂 出生日期: 1995-06-15
# 📅 今天日期: 2024-01-15
# 👤 年龄: 28 岁
# ⏳ 距离下一个生日: 152 天

时间格式化工具

from datetime import datetime

def format_time_friendly(dt):
    """把时间转成友好的相对描述"""
    now = datetime.now()
    diff = now - dt

    seconds = diff.total_seconds()

    if seconds < 60:
        return "刚刚"
    elif seconds < 3600:
        minutes = int(seconds // 60)
        return f"{minutes} 分钟前"
    elif seconds < 86400:
        hours = int(seconds // 3600)
        return f"{hours} 小时前"
    elif seconds < 604800:
        days = int(seconds // 86400)
        return f"{days} 天前"
    else:
        return dt.strftime("%Y-%m-%d")

# 使用
from datetime import timedelta

now = datetime.now()
print(format_time_friendly(now - timedelta(seconds=30)))   # 刚刚
print(format_time_friendly(now - timedelta(minutes=5)))    # 5 分钟前
print(format_time_friendly(now - timedelta(hours=3)))      # 3 小时前
print(format_time_friendly(now - timedelta(days=2)))       # 2 天前
print(format_time_friendly(now - timedelta(days=30)))      # 2024-12-16

10. 今日小结

用途
关键方法
date
日期
.today()
.weekday()
time
时间
.hour
.minute
datetime
日期+时间
.now()
.timestamp()
timedelta
时间差
.days
.total_seconds()
timezone
时区
.astimezone()

核心要点

  • ✅ date.today() 获取今天日期
  • ✅ datetime.now() 获取当前日期+时间
  • ✅ 日期相减 → timedelta,日期 + timedelta → 新日期
  • ✅ strftime() 格式化输出,strptime() 解析字符串
  • ✅ 时间戳 = 从 1970-01-01 到现在的秒数
  • ✅ 存储用 UTC,显示转本地时区
  • ✅ 用 ZoneInfo 处理标准时区(Python 3.9+)

速查表

from datetime import datetime, date, timedelta

# 获取当前
now = datetime.now()      # 当前日期+时间
today = date.today()      # 当前日期
ts = now.timestamp()      # 当前时间戳

# 格式化
now.strftime("%Y-%m-%d %H:%M:%S")   # → "2024-01-15 14:30:25"

# 解析
datetime.strptime("2024-01-15", "%Y-%m-%d")  # → datetime

# 计算
future = now + timedelta(days=7)     # 7天后
past = now - timedelta(hours=2)      # 2小时前
diff = (date(2025,1,1) - today).days # 距离天数

🎯 练习建议:
1. 写一个程序,计算从你出生到现在活了多少天、多少小时、多少秒
2. 写一个日程提醒工具:输入日期和事件名,自动显示"还有 X 天"
3. 写一个函数,把各种格式的日期字符串统一转成 "YYYY-MM-DD" 格式


📚 Day30 完成!明天学习 os 与 pathlib —— 文件目录操作一把梭

轻松时刻:

请在微信客户端打开

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-03 05:09:11 HTTP/2.0 GET : https://f.mffb.com.cn/a/498612.html
  2. 运行时间 : 0.158501s [ 吞吐率:6.31req/s ] 内存消耗:5,016.76kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=543d919d3939163ce6cd8dbca7df099e
  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.000338s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000758s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.006207s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.005543s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000763s ]
  6. SELECT * FROM `set` [ RunTime:0.005606s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000753s ]
  8. SELECT * FROM `article` WHERE `id` = 498612 LIMIT 1 [ RunTime:0.010374s ]
  9. UPDATE `article` SET `lasttime` = 1783026551 WHERE `id` = 498612 [ RunTime:0.000483s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.002207s ]
  11. SELECT * FROM `article` WHERE `id` < 498612 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.014710s ]
  12. SELECT * FROM `article` WHERE `id` > 498612 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.011022s ]
  13. SELECT * FROM `article` WHERE `id` < 498612 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.017704s ]
  14. SELECT * FROM `article` WHERE `id` < 498612 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.004949s ]
  15. SELECT * FROM `article` WHERE `id` < 498612 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.005576s ]
0.160319s