当前位置:首页>python>Python (八)时间与日历模块详解

Python (八)时间与日历模块详解

  • 2026-07-02 16:32:05
Python (八)时间与日历模块详解

Python 时间与日历模块详解

time / datetime / calendar 三大模块全解析

Python 学习笔记 · 第八篇

时间处理是编程中最常见也最容易出错的地方。想想你是不是遇到过这些问题:系统日志的时间戳看不懂?考勤统计不知道怎么算加班时长?节假日排班一头雾水?别担心,Python 提供了三个强大的时间模块帮你搞定一切——time、datetime、calendar,让我们一起来学习吧!

第一部分:time 模块
01struct_time 类基础概念

在 Python 中,时间信息被封装成一个叫做 struct_time 的"时间元组"对象。就像一个详细的时间表,包含了年、月、日、时、分、秒、星期几、一年中的第几天等 9 个属性。

Python
import time# 获取当前时间的 struct_time 对象current_time = time.localtime()print(current_time)# time.struct_time(tm_year=2024, tm_mon=1, tm_mday=15, tm_hour=14,#                  tm_min=30, tm_sec=45, tm_wday=0, tm_yday=15, tm_isdst=0)# 通过属性名访问print(f'年份: {current_time.tm_year}')      # 年份: 2024print(f'月份: {current_time.tm_mon}')       # 月份: 1print(f'日期: {current_time.tm_mday}')      # 日期: 15print(f'小时: {current_time.tm_hour}')      # 小时: 14print(f'分钟: {current_time.tm_min}')       # 分钟: 30print(f'秒数: {current_time.tm_sec}')       # 秒数: 45print(f'星期: {current_time.tm_wday}')      # 星期: 0 (0=周一, 6=周日)print(f'一年第几天: {current_time.tm_yday}') # 一年第几天: 15print(f'夏令时: {current_time.tm_isdst}')   # 夏令时: 0 (-1未知, 0不是, 1是)# 也可以通过索引访问(像元组一样)print(f'年份: {current_time[0]}')           # 年份: 2024

💡 小贴士

注意 tm_wday 星期的取值是 0-6,其中 0 代表星期一,6 代表星期日。这和我们平时说的"星期一是一周的第一天"一致,但要注意不要和其他模块的星期表示搞混了!

◆ ─────── ◆
02常用函数核心功能

time 模块提供了多种时间处理函数,包括获取时间戳、转换时间格式、程序休眠等,非常实用!

Python
import time# ===== 1. time() - 获取当前时间戳(从1970年1月1日00:00:00 UTC到现在的秒数)timestamp = time.time()print(f'当前时间戳: {timestamp}')  # 如: 1705296000.123456# 应用场景:日志时间戳log_timestamp = int(time.time())print(f'[LOG {log_timestamp}] 用户登录成功')# ===== 2. gmtime() - 时间戳转 UTC 时间的 struct_timeutc_time = time.gmtime()print(f'UTC 时间: {utc_time.tm_hour}:{utc_time.tm_min}')# ===== 3. localtime() - 时间戳转本地时间的 struct_timelocal_time = time.localtime()print(f'本地时间: {local_time.tm_hour}:{local_time.tm_min}')# ===== 4. mktime() - struct_time 转时间戳(反向转换)time_tuple = (2024, 2, 10, 9, 0, 0, 5, 41, 0)  # 年,月,日,时,分,秒,星期,年第几天,夏令时timestamp_from_tuple = time.mktime(time_tuple)print(f'2024年2月10日9点的时间戳: {timestamp_from_tuple}')# ===== 5. asctime() - struct_time 转可读字符串print(time.asctime(local_time))  # 'Mon Jan 15 14:30:45 2024'# ===== 6. ctime() - 时间戳转可读字符串print(time.ctime(timestamp))     # 'Mon Jan 15 14:30:45 2024'# ===== 7. sleep() - 让程序暂停指定秒数print('开始工作...')time.sleep(2)  # 暂停 2 秒print('工作完成!')# 应用场景:计算代码执行时间start_time = time.time()# 模拟耗时操作total = 0for i in range(1000000):    total += iend_time = time.time()print(f'循环执行耗时: {end_time - start_time:.3f} 秒')

⚠️ 踩坑经验

mktime() 接收的元组顺序是:年、月、日、时、分、秒、星期、一年中的第几天、夏令时。注意:星期和一年中的第几天参数会被自动忽略,Python 会根据年月日自动计算!

◆ ─────── ◆
03strftime 格式化符号实用工具

strftime() 是"string format time"的缩写,可以把时间格式化成任意你想要的字符串格式。就像给时间"换衣服",想穿什么款式都行!

Python
import timenow = time.localtime()# 常用格式示例print(time.strftime('%Y-%m-%d', now))           # 2024-01-15 (日期)print(time.strftime('%H:%M:%S', now))           # 14:30:45 (时间)print(time.strftime('%Y-%m-%d %H:%M:%S', now))  # 2024-01-15 14:30:45 (完整时间)print(time.strftime('%Y/%m/%d', now))           # 2024/01/15 (另一种日期格式)print(time.strftime('%B %d, %Y', now))          # January 15, 2024 (英文日期)print(time.strftime('%I:%M %p', now))           # 02:30 PM (12小时制)# 应用场景:文件名加时间戳filename = f'报告_{time.strftime("%Y%m%d_%H%M%S")}.txt'print(f'生成文件名: {filename}')  # 报告_20240115_143045.txt# 应用场景:日志格式log_time = time.strftime('[%Y-%m-%d %H:%M:%S]', now)print(f'{log_time} [INFO] 系统启动成功')

strftime 格式化符号对照表

符号
说明
示例
%Y
四位年份
2024
%y
两位年份
24
%m
两位月份
01
%d
两位日期
15
%H
24小时制小时
14
%I
12小时制小时
02
%M
分钟
30
%S
45
%p
AM/PM
PM
%a
简写星期
Mon
%A
完整星期
Monday
%b
简写月份
Jan
%B
完整月份
January
%j
一年中的第几天
015
%w
星期几(0-6, 0=周日)
1
%U
一年中的第几周(周日为第一天)
03
%W
一年中的第几周(周一为第一天)
03
%c
日期时间表示
Mon Jan 15 14:30:45 2024
%x
日期表示
01/15/24
%X
时间表示
14:30:45
%z
时区偏移
+0800
%Z
时区名称
CST
%%
% 字符本身
%

💡 小贴士

最常用的格式是 '%Y-%m-%d %H:%M:%S',记住这个就够应付 90% 的场景了!另外注意:%w 中 0 代表星期日,和 tm_wday 的 0 代表星期一不一样,千万不要搞混了!

◆ ─────── ◆
第二部分:datetime 模块
04date 类(日期)面向对象

datetime 模块是 Python 中处理时间的"瑞士军刀",采用面向对象设计。其中 date 类专门处理日期(年、月、日),不包含时间信息。

Python
from datetime import date# ===== 1. today() - 获取今天的日期today = date.today()print(f'今天是: {today}')  # 2024-01-15print(f'年: {today.year}, 月: {today.month}, 日: {today.day}')# ===== 2. fromtimestamp() - 时间戳转日期import timetimestamp = time.time()date_from_ts = date.fromtimestamp(timestamp)print(f'时间戳转日期: {date_from_ts}')# ===== 3. min / max - 日期的最小/最大值print(f'date 最小值: {date.min}')  # 0001-01-01print(f'date 最大值: {date.max}')  # 9999-12-31# ===== 4. replace() - 替换日期部分birthday = date(2000, 5, 20)next_birthday = birthday.replace(year=2024)print(f'下一个生日: {next_birthday}')  # 2024-05-20# ===== 5. timetuple() - 转 struct_timetime_tuple = today.timetuple()print(f'转换为元组: {time_tuple}')# ===== 6. weekday() - 获取星期几 (0=周一, 6=周日)weekday_num = today.weekday()weekdays = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日']print(f'今天是: {weekdays[weekday_num]}')# ===== 7. isoweekday() - 获取星期几 (1=周一, 7=周日)iso_weekday = today.isoweekday()print(f'ISO 星期: {iso_weekday}')# ===== 8. isocalendar() - 返回 (年, 周数, 星期)iso_cal = today.isocalendar()print(f'ISO 日历: 第{iso_cal.year}年, 第{iso_cal.week}周, 星期{iso_cal.weekday}')# ===== 9. isoformat() - ISO 格式字符串print(f'ISO 格式: {today.isoformat()}')  # 2024-01-15# ===== 10. strftime() - 自定义格式化print(today.strftime('%Y年%m月%d日'))  # 2024年01月15日# 应用场景:计算生日倒计时user_birthday = date(2000, 5, 20)this_year_birthday = date(today.year, user_birthday.month, user_birthday.day)if this_year_birthday < today:    this_year_birthday = this_year_birthday.replace(year=today.year + 1)days_left = (this_year_birthday - today).daysprint(f'距离生日还有 {days_left} 天!')

💡 小贴士

两个 date 对象相减会得到一个 timedelta 对象,表示时间差。可以用 .days 获取天数,非常适合做倒计时、计算间隔等!

◆ ─────── ◆
05time 类(时间)面向对象

datetime.time 类专门处理时间(时、分、秒、微秒、时区),不包含日期信息。

Python
from datetime import time# 创建 time 对象work_start = time(9, 0, 0)       # 9点上班work_end = time(18, 0, 0)        # 18点下班meeting_time = time(14, 30, 0)   # 14:30 开会print(f'上班时间: {work_start}')    # 09:00:00print(f'下班时间: {work_end}')      # 18:00:00# 属性访问print(f'时: {work_start.hour}, 分: {work_start.minute}, 秒: {work_start.second}')# ===== 1. isoformat() - ISO 格式字符串print(f'会议时间: {meeting_time.isoformat()}')  # 14:30:00# ===== 2. replace() - 替换时间部分new_meeting = meeting_time.replace(hour=15, minute=0)print(f'新会议时间: {new_meeting}')  # 15:00:00# ===== 3. strftime() - 自定义格式化print(work_start.strftime('%I:%M %p'))  # 09:00 AM# 时间比较(可以直接用 > < ==)current_time = time(10, 30, 0)if work_start < current_time < work_end:    print('现在是工作时间,好好上班!')else:    print('下班啦,休息一下~')# 包含微秒的精确时间precise_time = time(12, 30, 45, 123456)print(f'精确时间: {precise_time}')  # 12:30:45.123456print(f'微秒: {precise_time.microsecond}')  # 123456

⚠️ 踩坑经验

注意:datetime.time 类不能直接相减!如果要计算两个时间点之间的间隔,需要先把它们加到同一个日期上变成 datetime 对象再计算。

◆ ─────── ◆
06datetime 类(日期+时间)最常用

datetime.datetime 是最常用的类,它同时包含日期和时间信息,相当于 date + time 的组合!

Python
from datetime import datetime, timedelta# ===== 1. now() - 获取当前本地日期时间now = datetime.now()print(f'当前时间: {now}')  # 2024-01-15 14:30:45.123456# ===== 2. today() - 同 now()today = datetime.today()print(f'今天: {today}')# ===== 3. utcnow() - 获取 UTC 时间utc_now = datetime.utcnow()print(f'UTC 时间: {utc_now}')# ===== 4. fromtimestamp() - 时间戳转 datetimeimport timets = time.time()dt_from_ts = datetime.fromtimestamp(ts)print(f'时间戳转: {dt_from_ts}')# ===== 5. utcfromtimestamp() - 时间戳转 UTC datetimeutc_dt = datetime.utcfromtimestamp(ts)print(f'UTC 转换: {utc_dt}')# ===== 6. combine() - date 和 time 组合成 datetimefrom datetime import date, timed = date(2024, 2, 10)t = time(9, 30, 0)dt_combined = datetime.combine(d, t)print(f'组合结果: {dt_combined}')  # 2024-02-10 09:30:00# ===== 7. date() - 提取日期部分print(f'提取日期: {now.date()}')   # 2024-01-15# ===== 8. time() - 提取时间部分print(f'提取时间: {now.time()}')   # 14:30:45.123456# ===== timedelta - 时间差计算(计算加班时长示例)work_start = datetime(2024, 1, 15, 9, 0, 0)  # 9点上班work_end = datetime(2024, 1, 15, 20, 30, 0)  # 20:30下班work_duration = work_end - work_startprint(f'工作时长: {work_duration}')  # 11:30:00print(f'工作小时数: {work_duration.total_seconds() / 3600:.1f} 小时')# 标准工作时间 8 小时standard_work = timedelta(hours=8)overtime = work_duration - standard_workprint(f'加班时长: {overtime}')  # 3:30:00# 时间加减运算print(f'3天后: {now + timedelta(days=3)}')print(f'1周前: {now - timedelta(weeks=1)}')print(f'2小时后: {now + timedelta(hours=2)}')print(f'30分钟前: {now - timedelta(minutes=30)}')# 应用场景:打卡提醒checkin_time = datetime(now.year, now.month, now.day, 9, 0, 0)if now > checkin_time:    late_minutes = int((now - checkin_time).total_seconds() / 60)    print(f'⚠️ 迟到了 {late_minutes} 分钟!')else:    print('✅ 按时打卡,真棒!')

💡 小贴士

timedelta 是时间差神器!支持的参数有:days, seconds, microseconds, milliseconds, minutes, hours, weeks。注意:timedelta 内部只存储 days、seconds、microseconds 三个属性,其他单位会自动转换!

◆ ─────── ◆
第三部分:calendar 模块
07常用函数基础功能

calendar 模块专门处理日历相关的操作,比如判断闰年、获取某个月的日历、排班计算等,非常适合行政和HR场景!

Python
import calendar# ===== 1. 设置每周第一天(0=周一, 6=周日)calendar.setfirstweekday(0)  # 设置周一为第一天print(f'每周第一天: {calendar.firstweekday()}')  # 0# ===== 2. isleap() - 判断是否是闰年print(f'2024是闰年吗? {calendar.isleap(2024)}')  # Trueprint(f'2023是闰年吗? {calendar.isleap(2023)}')  # False# 闰年判断规则:能被4整除但不能被100整除,或者能被400整除def is_leap(year):    return (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0)# ===== 3. leapdays() - 计算两个年份之间的闰年数量print(f'2000到2024之间有 {calendar.leapdays(2000, 2025)} 个闰年')# ===== 4. weekday() - 获取某一天是星期几(0=周一, 6=周日)weekday_num = calendar.weekday(2024, 2, 10)weekdays = ['周一', '周二', '周三', '周四', '周五', '周六', '周日']print(f'2024年2月10日是 {weekdays[weekday_num]}')# ===== 5. monthrange() - 获取某月第一天是星期几,以及该月有多少天# 返回 (星期几, 天数)first_day, days_in_month = calendar.monthrange(2024, 2)print(f'2024年2月第一天是 {weekdays[first_day]},共有 {days_in_month} 天')# 应用场景:计算某个月的工作日天数workdays = 0for day in range(1, days_in_month + 1):    wd = calendar.weekday(2024, 2, day)    if wd < 5:  # 周一到周五是工作日        workdays += 1print(f'2024年2月有 {workdays} 个工作日')# ===== 6. month() - 输出某月的日历字符串print('2024年2月日历:')print(calendar.month(2024, 2))# ===== 7. prcal() - 直接打印全年日历# calendar.prcal(2024)  # 打印2024年全年日历

⚠️ 踩坑经验

注意 calendar.weekday() 返回的 0 是星期一,而 time.strftime('%w') 返回的 0 是星期日!同一个"星期几"在不同模块里编号不同,用的时候一定要测试清楚!

◆ ─────── ◆
08Calendar 类家族进阶功能

calendar 模块还提供了三个面向对象的类:CalendarTextCalendarHTMLCalendar,用于生成不同格式的日历!

Python
import calendar# ===== 1. Calendar 类 - 迭代器方式获取日期cal = calendar.Calendar(firstweekday=0)  # 周一为第一天# iterweekdays() - 获取一周每天的数字print('一周的日期编号:', list(cal.iterweekdays()))  # [0, 1, 2, 3, 4, 5, 6]# itermonthdates() - 迭代某月的所有日期(包含前后月份补齐的日期)print('2024年2月的所有日期:')for date_obj in cal.itermonthdates(2024, 2):    if date_obj.month == 2:  # 只打印2月的日期        print(f'  {date_obj}', end='')print()# ===== 2. TextCalendar 类 - 生成文本格式日历text_cal = calendar.TextCalendar(firstweekday=0)# formatmonth() - 格式化某个月print(text_cal.formatmonth(2024, 2))# formatyear() - 格式化全年(w=每个日期宽度, l=行高, c=列间距, m=列数)# print(text_cal.formatyear(2024, m=3))  # 3列显示全年# ===== 3. HTMLCalendar 类 - 生成 HTML 格式日历html_cal = calendar.HTMLCalendar(firstweekday=0)# formatmonth() - 生成某月的 HTMLmonth_html = html_cal.formatmonth(2024, 2)print('生成的 HTML 日历前200字符:')print(month_html[:200] + '...')# formatyear() - 生成全年的 HTML# year_html = html_cal.formatyear(2024)# formatyearpage() - 生成完整的 HTML 页面# year_page = html_cal.formatyearpage(2024)# 应用场景:排班表生成print('\n2024年2月排班表(周一-周五上班):')for day in range(1, 30):    try:        wd = calendar.weekday(2024, 2, day)        if wd < 5:            status = '☀️ 上班'        else:            status = '🌙 休息'        print(f'  2月{day}日 {weekdays[wd]}: {status}')    except:        break

💡 小贴士

HTMLCalendar 非常适合在网页上显示日历!你可以把生成的 HTML 嵌入到任何网页中,甚至可以继承这个类来自定义样式,给节假日标上不同的颜色,做成精美的排班日历。

◆ ─────── ◆
09三模块对比与选择总结

三个模块各有侧重,根据场景选择最合适的工具:

模块
特点
适用场景
time
底层 C 库接口,处理时间戳和 struct_time
① 性能计时(代码运行时间)② 日志时间戳③ 简单的时间格式化④ 程序 sleep 暂停
datetime
面向对象设计,日期时间计算方便
① ✅ 大多数日常场景首选② 日期时间加减(倒计时、间隔)③ 生日、纪念日提醒④ 考勤时长计算
calendar
日历相关操作,闰年判断、排班
① 判断闰年② 生成日历(文本/HTML)③ 工作日统计、排班表④ 获取月份天数

💡 选择建议

一般来说,datetime 模块 是最好的选择,它功能全面且易用。只有在需要精确性能计时或底层时间戳操作时才用 time,涉及日历排班时才用 calendar。记住这三个模块可以互相转换,灵活搭配使用更高效!

◆ ─────── ◆

时间处理是编程中最常见的需求之一。掌握了这三个模块,无论是日志记录、定时任务、考勤统计还是排班系统,你都能轻松应对!记住:选择合适的工具,让代码更简洁,让工作更高效。

下一篇:Python 文件操作详解 →

Python 学习笔记系列 | 第八篇

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-02 23:32:13 HTTP/2.0 GET : https://f.mffb.com.cn/a/495873.html
  2. 运行时间 : 0.143447s [ 吞吐率:6.97req/s ] 内存消耗:4,593.76kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=bd394e392b1d82e7ac57f8473529d876
  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.000596s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000673s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.003606s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.002145s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000613s ]
  6. SELECT * FROM `set` [ RunTime:0.003387s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000572s ]
  8. SELECT * FROM `article` WHERE `id` = 495873 LIMIT 1 [ RunTime:0.010473s ]
  9. UPDATE `article` SET `lasttime` = 1783006333 WHERE `id` = 495873 [ RunTime:0.012055s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000338s ]
  11. SELECT * FROM `article` WHERE `id` < 495873 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000550s ]
  12. SELECT * FROM `article` WHERE `id` > 495873 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000463s ]
  13. SELECT * FROM `article` WHERE `id` < 495873 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.001820s ]
  14. SELECT * FROM `article` WHERE `id` < 495873 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.012080s ]
  15. SELECT * FROM `article` WHERE `id` < 495873 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.021207s ]
0.145105s