当前位置:首页>python>每天10分钟玩转Python基础篇 - 文件IO操作

每天10分钟玩转Python基础篇 - 文件IO操作

  • 2026-09-04 14:49:58
每天10分钟玩转Python基础篇 - 文件IO操作
PYTHON · 基础篇第10课2026.08

还在用 os.path 拼字符串路径?

给你的程序,接上文件

pathlib + shutil · 文件IO

📦 3 PARTS + CONCLUSION

👉 滑动

PART 01

通俗原理

Path 对象

PART 02

核心用法

7 个套路

PART 03

完整案例

批量整理

PART ///

写在最后

避坑自检

这是基础篇第10篇。前面我们学了变量、循环、字符串、列表字典集合、argparse、正则、datetime、异常处理。今天学一个让你的程序能「读写文件、整理目录」的技能:pathlib(文件路径处理)。

你有没有遇到过这些需求:把某个目录下的文件批量重命名、读一个配置文件、统计文件夹里所有文件的总字数、按后缀把文件分类整理?

这些全都要靠文件操作。Python 的 pathlib 模块就是干这个的——用面向对象的方式处理路径和文件,读写、遍历、重命名,一把搞定。

PART 01

通俗原理:Path 对象

以前处理路径,大家用的是字符串拼接("data/" + "logs/" + "app.log"),又丑又容易出错(Windows 和 Linux 的路径分隔符不一样)。

pathlib 的思路是:把路径当成一个对象Path),路径拼接用 / 运算符,跨平台自动处理分隔符:

python

from pathlib importPath

p=Path("data")/"logs"/"app.log"

print(p)# data\logs\app.log(Windows 显示 \,Linux 显示 /)

Path("data") 创建一个路径对象,/ 运算符往下拼一层,代码干净又跨平台。

PART 02

核心用法:7 个套路

STEP 01

创建路径 + 拼接

python

from pathlib importPath

p=Path("data")/"logs"/"app.log"# 用 / 拼接

print(p)# data\logs\app.log

/ 运算符是 pathlib 最核心的语法糖,左边是 Path 对象,右边是字符串,拼出一个新路径。

STEP 02

取路径的各个部分

python

f=Path("report.txt")

print(f.name)# report.txt  文件名

print(f.stem)# report      不含后缀

print(f.suffix)# .txt        后缀

print(f.parent)# .           父目录

namestemsuffixparent 这几个属性,取路径的各个部分,不用再手动 split 了。

STEP 03

读写文件

python

out=Path("output")

out.mkdir(exist_ok=True)# 创建目录(已存在也不报错)

f=out/"hello.txt"

f.write_text("你好,飞污熊!",encoding="utf-8")# 写文件

print(f.read_text(encoding="utf-8"))# 读文件

write_text 写文本文件,read_text 读文本文件,比 open() 那一套简洁多了。mkdir(exist_ok=True) 创建目录,exist_ok=True 表示「已存在就不报错」。

STEP 04

判断存在和类型

python

print(f.exists())# True  是否存在

print(f.is_file())# True  是不是文件

print(out.is_dir())# True  是不是目录

这三个方法判断路径的存在和类型,做文件处理前先判断,避免踩坑。

STEP 05

遍历目录

python

foriteminout.iterdir():

print(item.name,"是文件?",item.is_file())

iterdir() 遍历目录下的所有内容,返回一个个 Path 对象。

STEP 06

用通配符匹配文件

python

forpyinout.glob("*.py"):

print(py.name)# 所有 .py 文件

glob("*.py") 用通配符匹配文件,* 匹配任意字符。想递归匹配所有子目录,用 "**/*.py"

STEP 07

重命名文件

python

forfinout.glob("*.txt"):

new=f.with_suffix(".md")# 换后缀

f.rename(new)# 重命名

with_suffix 替换后缀,rename 重命名(也能用来移动文件)。

PART 03

完整案例:批量整理文件

把上面串起来,写一个「批量整理文件」小工具——把目录下所有 .txt 改成 .md,并统计总字数:

python

from pathlib importPath

out=Path("output")

out.mkdir(exist_ok=True)

fornamein["a.txt","b.txt","c.txt"]:

(out/name).write_text(f"这是 {name} 的内容",encoding="utf-8")

forfinout.glob("*.txt"):

f.rename(f.with_suffix(".md"))

print(f"重命名: {f.name} → {f.with_suffix('.md').name}")

total=0

forfinout.glob("*"):

iff.is_file():

total+=len(f.read_text(encoding="utf-8"))

print(f"总字数: {total}")

第一个循环:glob("*.txt") 找出所有 .txt,with_suffix(".md") 换成 .md 后缀,rename 完成重命名。第二个循环:遍历所有文件,read_text 读内容,len 统计字数,累加得到总数。这就是一个完整的文件整理脚本。

进阶

shutil:高级文件操作

pathlib 适合「路径处理 + 读写文件」,但如果要复制、移动、删除整个目录,shutil 更合适:

python

import shutil

shutil.copy("a.txt","backup/a.txt")# 复制文件

shutil.copytree("src","backup")# 复制整个目录树

shutil.move("a.txt","归档/a.txt")# 移动文件(也能重命名)

shutil.rmtree("临时目录")# 删除整个目录树(递归删除,慎用)

total,used,free=shutil.disk_usage(".")# 磁盘空间

print(f"剩余空间 {free / (1024**3):.1f} GB")

copy 复制单个文件;copy2 复制并保留元数据。 copytree 复制整个目录树;move 移动文件/目录。 rmtree 递归删除目录树(比 pathlib 的 rmdir 强,能删非空目录);disk_usage 查磁盘空间。

一句话区分:pathlib 管「路径 + 读写文件」,shutil 管「复制/移动/删除整个文件或目录」。日常写脚本时两个常常一起用。

避坑指南

4 个常见坑

with_suffix 不会自动修改文件的名称f.with_suffix(".md") 只是返回一个新的 Path 对象(后缀变了),原文件没动。要真正改名,得用 rename()

读文件要指定编码:中文文件要写 read_text(encoding="utf-8"),否则可能报错或乱码。写文件同理。

相对路径 vs 绝对路径Path("data") 是相对路径,相对你运行脚本时所在的目录,不是脚本文件所在目录。要稳定定位,用绝对路径。

删除文件用 unlink()Path("x.txt").unlink() 删除文件(目录用 rmdir(),只能删空目录)。删除不可恢复,慎用。

自测检查

4 道题

① 能用 Path 创建路径并用 / 拼出一个文件路径吗?

② 能取出一个文件的 namesuffixparent 吗?

③ 能用 write_text 写文件、read_text 读文件吗?

④ 能用 glob("*.py") 找出目录下所有 .py 文件并重命名吗?

这四题都能答上来,pathlib 你就入门了。文件操作是写正经程序绕不开的技能——日志、配置、数据,都要落地到文件,现在你有了趁手的工具。

既然看到这里了,如果觉得有用,随手点个赞、在看、转发三连吧。

点赞
在看
转发

THANKS FOR READING

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-09-05 07:17:57 HTTP/2.0 GET : https://f.mffb.com.cn/a/512423.html
  2. 运行时间 : 0.062169s [ 吞吐率:16.09req/s ] 内存消耗:4,678.31kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=0bdc819266af6d9d953fe2a3de3ca599
  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.000401s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000624s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000338s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000249s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000408s ]
  6. SELECT * FROM `set` [ RunTime:0.000192s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000604s ]
  8. SELECT * FROM `article` WHERE `id` = 512423 LIMIT 1 [ RunTime:0.000252s ]
  9. UPDATE `article` SET `lasttime` = 1788563877 WHERE `id` = 512423 [ RunTime:0.002987s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000253s ]
  11. SELECT * FROM `article` WHERE `id` < 512423 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000367s ]
  12. SELECT * FROM `article` WHERE `id` > 512423 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000358s ]
  13. SELECT * FROM `article` WHERE `id` < 512423 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.000548s ]
  14. SELECT * FROM `article` WHERE `id` < 512423 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.000733s ]
  15. SELECT * FROM `article` WHERE `id` < 512423 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.001835s ]
0.070211s