当前位置:首页>python>第356讲:用 Python 和 VBA 两条线对照着来:复杂的日期逻辑与时区转换

第356讲:用 Python 和 VBA 两条线对照着来:复杂的日期逻辑与时区转换

  • 2026-09-04 13:58:50
第356讲:用 Python 和 VBA 两条线对照着来:复杂的日期逻辑与时区转换

做全球化业务的同学大概率都踩过时区的坑。

中美欧三地团队,美国同事说"我周一上的线",你一查数据库——好家伙,北京时间已经是周二凌晨4点了。到底算哪天的打卡?自然周从哪天算起?夏令时怎么办?

今天这讲,我们就把这个问题彻底讲透。用 Python 和 VBA 两条线对照着来,顺便聊聊为什么 Python 处理这类问题几乎是降维打击,而 VBA 里有哪些"看起来能用、实际会炸"的暗坑。


一、问题拆解:我们到底要解决什么?

先明确需求,别急着写代码:

  1. 多时区时间统一:美国东部时间(ET)、欧洲中部时间(CET)、中国北京时间(CST),全部转换为北京时间(UTC+8)

  2. 夏令时处理:美国3月第二个周日开始夏令时(UTC-4),11月第一个周日结束(UTC-5);欧洲3月最后一个周日进夏令时(UTC+2),10月最后一个周日退出(UTC+1)

  3. 自然周归属:ISO 8601 标准定义——一周从周一开始,第1周是包含该年第一个周四的那一周。这个标准在跨国排班、周报统计中几乎是唯一不踩坑的定义

  4. 输出结果:每条原始记录 → 北京时间 → 所属自然年 + 自然周


二、Python 实现:pandas 的优雅之道

2.1 核心工具

Python 处理时区的主力是 pandas搭配 pytz(或 Python 3.9+ 的 zoneinfo)。核心就两个方法:

  • tz_localize():给" naive "的时间戳打上时区标签

  • tz_convert():在不同时区之间转换

以及 isocalendar():一行代码拿到 ISO 年份和周数。

2.2 完整实现

import pandas as pdfrom datetime import datetimeimport pytz# ========================================# 模拟数据:三地团队的打卡时间(均为当地时间)# ========================================records = [    # 美国东部时间(非夏令时期间)    {"name""Alice(US)",  "local_time""2024-01-15 09:00:00""tz""US/Eastern"},    # 美国东部时间(夏令时期间)    {"name""Alice(US)",  "local_time""2024-07-15 09:00:00""tz""US/Eastern"},    # 欧洲中部时间(非夏令时期间)    {"name""Hans(DE)",   "local_time""2024-02-10 14:00:00""tz""Europe/Berlin"},    # 欧洲中部时间(夏令时期间)    {"name""Hans(DE)",   "local_time""2024-08-10 14:00:00""tz""Europe/Berlin"},    # 北京时间    {"name""小明(CN)",   "local_time""2024-03-20 18:00:00""tz""Asia/Shanghai"},]# ========================================# 转换函数# ========================================def convert_to_beijing(local_str, tz_name):    """    将任意时区的本地时间转换为北京时间,    并返回 ISO 自然周信息    """    # 1. 解析为 naive datetime    naive_dt = pd.to_datetime(local_str)    # 2. 本地化 —— 打上时区标签(这一步自动处理夏令时!)    local_tz = pytz.timezone(tz_name)    localized = naive_dt.tz_localize(local_tz)    # 3. 转换为北京时间    beijing_tz = pytz.timezone("Asia/Shanghai")    beijing_time = localized.tz_convert(beijing_tz)    # 4. 提取 ISO 自然周    iso_year, iso_week, iso_day = beijing_time.isocalendar()    return beijing_time, iso_year, iso_week, iso_day# ========================================# 批量处理 + 输出# ========================================print(f"{'姓名':<12}{'原始时间(当地)':<22}{'北京时间':<22}{'ISO周'}")print("-" * 70)for r in records:    bt, year, week, day = convert_to_beijing(r["local_time"], r["tz"])    print(f"{r['name']:<12}{r['local_time']:<22} "          f"{bt.strftime('%Y-%m-%d %H:%M:%S %Z'):<22} "          f"{year}-W{week:02d} (周{day})")

2.3 输出结果示例

姓名          原始时间(当地)            北京时间                  ISO周----------------------------------------------------------------------Alice(US)    2024-01-15 09:00:00    2024-01-15 22:00:00 CST    2024-W03 (周1)Alice(US)    2024-07-15 09:00:00    2024-07-15 21:00:00 CST    2024-W29 (周1)Hans(DE)     2024-02-10 14:00:00    2024-02-10 21:00:00 CST    2024-W06 (周6)Hans(DE)     2024-08-10 14:00:00    2024-08-10 20:00:00 CST    2024-W32 (周6)小明(CN)     2024-03-20 18:00:00    2024-03-20 18:00:00 CST    2024-W12 (周3)

2.4 为什么这段代码"优雅"?

第一,夏令时零感知成本。pytz.timezone("US/Eastern")内置了历史所有年份的夏令时切换规则。你不需要知道2024年美国夏令时是3月10日开始——库帮你算好了。

第二,时区转换是数学操作,不是字符串拼接。tz_convert内部做的是 UTC 时间戳的偏移计算,不会因为格式问题出错。

第三,isocalendar()一步到位。 不用自己写逻辑判断"1月1日如果是周五,算上一年的第52周还是本年第1周"——ISO 标准已经帮你定义好了。

💡 干货补充:如果你处理的是大量数据(比如几十万行打卡记录),直接用 pd.Series.dt.tz_convert向量化操作,比逐行循环快几十倍:

df['beijing_time'] = df['utc_time'].dt.tz_convert('Asia/Shanghai')
df[['iso_year', 'iso_week', 'iso_day']] = 
    df['beijing_time'].dt.isocalendar()

三、VBA 实现:手动偏移的"硬核"之路

3.1 现实约束

VBA 没有内置的 IANA 时区数据库,没有 pytz,甚至 Date类型本身不带时区信息。所以 VBA 处理时区的唯一现实路径是:用固定数值偏移量手动计算

3.2 夏令时:为什么是"坑"?

地区

标准偏移(UTC)

夏令时偏移(UTC)

切换日期

美国东部

UTC-5

UTC-4

3月第2周日 / 11月第1周日

欧洲中部

UTC+1

UTC+2

3月最后周日 / 10月最后周日

北京时间

UTC+8

无夏令时

VBA 里你可以用 DateAdd("h", offset, dt)来做偏移,但夏令时的切换日期每年不同,需要自己写函数判断。

3.3 完整 VBA 代码

Option Explicit'==========================================================' 工具函数:判断美国是否处于夏令时' 规则:3月第二个周日 02:00 开始 → 11月第一个周日 02:00 结束'==========================================================Public Function IsUSDaylightSaving(dt As DateAs Boolean    Dim year As Integer    year = Year(dt)    ' 3月第二个周日    Dim mar1 As Date, secondSundayMar As Date    mar1 = DateSerial(year, 3, 1)    secondSundayMar = DateAdd("d", (8 - Weekday(mar1, vbSunday)) + 7, mar1)    ' 11月第一个周日    Dim nov1 As Date, firstSundayNov As Date    nov1 = DateSerial(year111)    firstSundayNov = DateAdd("d", (8 - Weekday(nov1, vbSunday)) - 1, nov1)    IsUSDaylightSaving = (dt >= secondSundayMar) And (dt < firstSundayNov)End Function'==========================================================' 工具函数:判断欧洲是否处于夏令时' 规则:3月最后一个周日 → 10月最后一个周日'==========================================================Public Function IsEuropeDaylightSaving(dt As DateAs Boolean    Dim year As Integer    year = Year(dt)    ' 3月最后一个周日    Dim mar31 As Date, lastSundayMar As Date    mar31 = DateSerial(year, 3, 31)    lastSundayMar = DateAdd("d", -(Weekday(mar31, vbSunday) - 1), mar31)    ' 10月最后一个周日    Dim oct31 As Date, lastSundayOct As Date    oct31 = DateSerial(year1031)    lastSundayOct = DateAdd("d", -(Weekday(oct31, vbSunday) - 1), oct31)    IsEuropeDaylightSaving = (dt >= lastSundayMar) And (dt < lastSundayOct)End Function'==========================================================' 主函数:将当地时间转换为北京时间'==========================================================Public Function ConvertToBeijing(localTime As Date, region As String) As Date    Dim offset As Double  ' 小时偏移量(相对于UTC)    Select Case UCase(region)        Case "US"            If IsUSDaylightSaving(localTimeThen                offset = 12   ' UTC-4 → UTC+8 = +12h            Else                offset = 13   ' UTC-5 → UTC+8 = +13h            End If        Case "EU", "DE", "EUROPE"            If IsEuropeDaylightSaving(localTimeThen                offset = 6    ' UTC+2 → UTC+8 = +6h            Else                offset = 7    ' UTC+1 → UTC+8 = +7h            End If        Case "CN", "BEIJING"            offset = 0        ' 已经是北京时间        Case Else            Err.Raise vbObjectError + 1, , "未知地区代码: " & region    End Select    ConvertToBeijing = DateAdd("h", offset, localTime)End Function'==========================================================' 获取 ISO 自然周(VBA 没有内置 isocalendar,自己实现)'==========================================================Public Function GetISOWeek(dt As DateAs String    ' Excel 的 Weekday(dt, vbMonday) 返回 1=周一 ... 7=周日    ' ISO 8601: 周四所在的周 = 第1    Dim thursday As Date    thursday = DateAdd("d", 4 - Weekday(dt, vbMonday), dt)    Dim jan1 As Date    jan1 = DateSerial(Year(thursday), 11)    Dim weekNum As Integer    weekNum = Int((thursday - jan1) / 7+ 1    GetISOWeek = Year(thursday) & "-W" & Format(weekNum, "00")End Function'==========================================================' 测试入口'==========================================================Public Sub TestTimezoneConversion()    Dim testCases As Variant    testCases = Array( _        Array("Alice(US)", #1/15/2024 9:00:00 AM#, "US"), _        Array("Alice(US)", #7/15/2024 9:00:00 AM#, "US"), _        Array("Hans(DE)", #2/10/2024 2:00:00 PM#, "DE"), _        Array("Hans(DE)", #8/10/2024 2:00:00 PM#, "DE"), _        Array("小明(CN)", #3/20/2024 6:00:00 PM#, "CN") _    )    Dim i As Integer    Debug.Print "姓名" & vbTab & "原始时间" & vbTab & vbTab & "北京时间" & vbTab & vbTab & "ISO周"    Debug.Print String(65, "-")    For i = 0 To UBound(testCases)        Dim bt As Date        bt = ConvertToBeijing(testCases(i)(1), testCases(i)(2))        Debug.Print testCases(i)(0) & vbTab & _                   Format(testCases(i)(1), "yyyy-mm-dd hh:nn") & vbTab & _                   Format(bt, "yyyy-mm-dd hh:nn") & vbTab & _                   GetISOWeek(bt)    Next iEnd Sub

3.4 VBA 方案的致命局限

1. 夏令时规则是硬编码的。 美国国会2005年改过一次夏令时起止日期(从4月→3月),如果你处理2006年之前的数据,上面代码就错了。Python 的 pytz包含1883年以来的所有历史规则。

2. 切换时刻的边界问题。 夏令时切换当天 02:00 这个时刻,时钟会回拨或跳进一小时,导致某些本地时间"不存在"或"出现两次"。VBA 代码没有处理这种歧义。

3. Weekday函数的坑。 VBA 的 Weekday(date, firstdayofweek)参数如果不显式传 vbMonday,默认以周日为一周第一天。很多人的 ISO 周计算错误,就是栽在这个默认参数上。

⚠️ 强烈建议:如果系统允许,VBA 端只做纯数值偏移(即假设固定 UTC+8,不做夏令时判断),把夏令时逻辑放到数据库层或 Python 层处理。VBA 维护时区规则表本身就是个定时炸弹。


四、Python vs VBA 对照总结

维度

Python (pandas + pytz)

VBA

夏令时

✅ 内置数据库,自动处理

❌ 需手写规则,且难维护

时区转换

tz_convert()一行搞定

DateAdd+ 偏移量手动算

自然周

isocalendar()标准输出

需自行实现 ISO 8601 逻辑

批量性能

向量化,毫秒级处理万行

逐行循环,慢

历史数据

支持任意历史年份

规则变更年份会出错

适用场景

数据管道、后端服务、分析

遗留 Excel 报表、轻量前端

一句话结论:新项目能上 Python 就上 Python;VBA 场景建议只做展示层,时区转换逻辑下沉到数据库(比如 SQL Server 的 AT TIME ZONE或 MySQL 的 CONVERT_TZ)。


五、额外干货:SQL 层怎么做?

既然提到了,顺手给一个 SQL Server 的方案,适合 VBA 从数据库取数时直接拿到正确结果:

-- SQL Server 2016+SELECT    [Name],    [LocalTime],    [LocalTimeAT TIME ZONE 'Eastern Standard Time'                 AT TIME ZONE 'China Standard Time' AS BeijingTime,    DATEPART(ISO_WEEK, [LocalTimeAT TIME ZONE 'Eastern Standard Time'                                     AT TIME ZONE 'China Standard Time'AS ISOWeekFROM TimeRecords;

一行 SQL 搞定,连 Python 都不用写。这才是 VBA 报表最推荐的架构。


六、课后练习

以下 5 道选择题检验一下掌握程度,答案在文末。


Q1. Python 中 tz_localize()和 tz_convert()的区别是什么?

A. 两者完全等价,可以互换使用

B. tz_localize()给 naive 时间打上时区标签;tz_convert()在不同时区之间转换

C. tz_localize()用于字符串解析;tz_convert()用于格式化输出

D. tz_localize()只能用于 UTC 时间

Q2. 根据 ISO 8601 标准,一年的第1周定义为:

A. 包含1月1日的那一周

B. 第一个完整7天的周

C. 包含该年第一个周四的那一周

D. 从1月第一个周一开始计算的周

Q3. VBA 中使用 DateAdd("h", 12, dt)将美国东部时间转为北京时间。在非夏令时期间,这个偏移量:

A. 正确(UTC-5 → UTC+8 = +13h,所以12不对)

B. 正确(UTC-4 → UTC+8 = +12h,恰好匹配)

C. 夏令时和非夏令时都应该用 +12h

D. 应该用 +8h

Q4. VBA 中 Weekday(#2024-01-01#, vbMonday)的返回值是?(2024年1月1日是周一)

A. 0

B. 1

C. 2

D. 7

Q5. 关于 Python pandas.isocalendar()的返回值,以下说法正确的是:

A. 返回元组 (year, quarter, month)

B. 返回元组 (year, week, day) 其中 day 为 0-6

C. 返回元组 (year, week, day) 其中 day 为 1-7(1=周一)

D. 返回整数,表示一年中的第几周


答案

Q1 → B

tz_localize()的作用是给没有时区信息的 datetime 赋予时区(比如告诉系统"这个时间是美国东部时间");tz_convert()则是在已知时区的基础上转换到另一个时区。顺序不能反——没打标签就转换会报错。

Q2 → C

ISO 8601 定义:第01周是包含该年第一个周四的那一周。等价于"1月4日所在的周"。这意味着1月1日如果是周一/周二/周三,可能属于上一年的第52或53周。

Q3 → A

美国东部标准时间(非夏令时)是 UTC-5,北京时间是 UTC+8,差值 = 8 - (-5) = 13 小时。所以 DateAdd("h", 12, ...)在非夏令时期间是错的,会少算1小时。这也是为什么 VBA 必须判断夏令时。

Q4 → B

Weekday(date, vbMonday)指定周一为一周第一天(返回1),2024年1月1日恰好是周一,所以返回 1。如果不传 vbMonday,默认以周日为第一天,则会返回 2——这就是很多人 ISO 周算错的根源。

Q5 → C

isocalendar()返回 namedtuple (year, week, day),其中 day范围是 1–7,1 代表周一,7 代表周日。注意不是 0-6,这是和 Python weekday()方法(返回 0-6)不同的地方,容易混淆。


最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-09-06 03:25:15 HTTP/2.0 GET : https://f.mffb.com.cn/a/512439.html
  2. 运行时间 : 0.059222s [ 吞吐率:16.89req/s ] 内存消耗:4,496.48kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=a80ce8f2dabc1831bad51e8140113787
  1. /www/wwwroot/mffb/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /www/wwwroot/mffb/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /www/wwwroot/mffb/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /www/wwwroot/mffb/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /www/wwwroot/mffb/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /www/wwwroot/mffb/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /www/wwwroot/mffb/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /www/wwwroot/mffb/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /www/wwwroot/mffb/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /www/wwwroot/mffb/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /www/wwwroot/mffb/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /www/wwwroot/mffb/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /www/wwwroot/mffb/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /www/wwwroot/mffb/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /www/wwwroot/mffb/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /www/wwwroot/mffb/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /www/wwwroot/mffb/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /www/wwwroot/mffb/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /www/wwwroot/mffb/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /www/wwwroot/mffb/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /www/wwwroot/mffb/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /www/wwwroot/mffb/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /www/wwwroot/mffb/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /www/wwwroot/mffb/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /www/wwwroot/mffb/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /www/wwwroot/mffb/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /www/wwwroot/mffb/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /www/wwwroot/mffb/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /www/wwwroot/mffb/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /www/wwwroot/mffb/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /www/wwwroot/mffb/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /www/wwwroot/mffb/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /www/wwwroot/mffb/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /www/wwwroot/mffb/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /www/wwwroot/mffb/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /www/wwwroot/mffb/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /www/wwwroot/mffb/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /www/wwwroot/mffb/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /www/wwwroot/mffb/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /www/wwwroot/mffb/f.mffb.com.cn/runtime/temp/ee3f15ab4905c6d51f7fc3c6e12961f5.php ( 11.95 KB )
  140. /www/wwwroot/mffb/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000381s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000541s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000280s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000238s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000379s ]
  6. SELECT * FROM `set` [ RunTime:0.000178s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000408s ]
  8. SELECT * FROM `article` WHERE `id` = 512439 LIMIT 1 [ RunTime:0.000355s ]
  9. UPDATE `article` SET `lasttime` = 1788636315 WHERE `id` = 512439 [ RunTime:0.003144s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000211s ]
  11. SELECT * FROM `article` WHERE `id` < 512439 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000300s ]
  12. SELECT * FROM `article` WHERE `id` > 512439 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000245s ]
  13. SELECT * FROM `article` WHERE `id` < 512439 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.000440s ]
  14. SELECT * FROM `article` WHERE `id` < 512439 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.000562s ]
  15. SELECT * FROM `article` WHERE `id` < 512439 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.000489s ]
0.066242s