当前位置:首页>python>Python字典的增删改查——键值对操作大全

Python字典的增删改查——键值对操作大全

  • 2026-03-26 22:12:24
Python字典的增删改查——键值对操作大全

一、回顾:什么是字典?

字典(dict)是 Python 中存储键值对的容器,键唯一且不可变,值可以是任意类型。字典是可变的,因此我们可以动态地添加、修改、删除其中的键值对,也可以方便地查找和访问。

student = {"name""小明""age"18}

本文将系统介绍字典的增、删、改、查操作,并涵盖相关方法和注意事项。


二、增加和修改字典元素(增 / 改)

2.1 直接赋值 dict[键] = 值

如果键不存在,则为添加新键值对;如果键已存在,则为修改对应值。

student = {"name""小明""age"18}# 修改已有键的值student["age"] = 19print(student)  # {'name': '小明', 'age': 19}# 添加新的键值对student["city"] = "北京"print(student)  # {'name': '小明', 'age': 19, 'city': '北京'}

2.2 使用 update() 方法合并字典

update([other]) 方法可以将另一个字典或可迭代的键值对添加到当前字典中,如果键重复,则覆盖原值。

student = {"name""小明""age"18}# 用另一个字典更新new_info = {"age"20"score"95}student.update(new_info)print(student)  # {'name': '小明', 'age': 20, 'score': 95}# 直接传入键值对元组列表student.update([("gender""男"), ("city""上海")])print(student)  # {'name': '小明', 'age': 20, 'score': 95, 'gender': '男', 'city': '上海'}# 使用关键字参数(键名必须是合法标识符)student.update(hobby="篮球", height=175)print(student)  # ... 'hobby': '篮球', 'height': 175

注意:update() 没有返回值,直接修改原字典。


三、删除字典元素(删)

3.1 del 语句——按键删除

student = {"name""小明""age"18"city""北京"}del student["age"]print(student)  # {'name': '小明', 'city': '北京'}# 删除不存在的键会引发 KeyError# del student["gender"]  # KeyError

del 还可以删除整个字典变量:

del student# print(student)  # NameError: name 'student' is not defined

3.2 pop() 方法——删除并返回指定键的值

pop(key[, default]) 删除指定键,并返回其对应的值。如果键不存在,返回 default(若未提供 default 则引发 KeyError)。

student = {"name""小明""age"18"city""北京"}age = student.pop("age")print(age)       # 18print(student)   # {'name': '小明', 'city': '北京'}# 安全删除,提供默认值gender = student.pop("gender""未知")print(gender)    # 未知

3.3 popitem() 方法——删除并返回最后一个键值对

popitem() 在 Python 3.7+ 中删除并返回字典中最后插入的一个键值对(LIFO),以元组形式返回。在旧版本中随机删除。

student = {"name""小明""age"18"city""北京"}item = student.popitem()print(item)      # ('city', '北京')print(student)   # {'name': '小明', 'age': 18}

如果字典为空,调用 popitem() 会引发 KeyError

3.4 clear() 方法——清空所有键值对

student = {"name""小明""age"18}student.clear()print(student)   # {}

四、查找与访问字典元素(查)

4.1 通过键直接访问 dict[键]

student = {"name""小明""age"18}print(student["name"])   # 小明# print(student["gender"])  # KeyError

如果键不存在,会抛出 KeyError,因此通常配合 in 检查或使用 get()

4.2 get() 方法——安全获取值

get(key[, default]) 返回键对应的值,如果键不存在则返回 default(默认 None)。

student = {"name""小明""age"18}print(student.get("name"))          # 小明print(student.get("gender"))        # Noneprint(student.get("gender""未知")) # 未知

4.3 setdefault() 方法——获取或设置默认值

setdefault(key[, default]) 如果键存在,返回其值;如果键不存在,插入该键并设置为 default(默认为 None),然后返回该值。

student = {"name""小明""age"18}age = student.setdefault("age"20)print(age)          # 18(原值)print(student)      # {'name': '小明', 'age': 18}gender = student.setdefault("gender""男")print(gender)       # 男(新插入的值)print(student)      # {'name': '小明', 'age': 18, 'gender': '男'}

4.4 使用 in 检查键是否存在

student = {"name""小明""age"18}if"age"in student:print("年龄存在")if"score"notin student:print("分数不存在")

4.5 获取所有键、值、键值对

  • • keys():返回所有键的视图(可迭代、类似集合)。
  • • values():返回所有值的视图。
  • • items():返回所有键值对的视图,每个元素是 (键, 值) 元组。
student = {"name""小明""age"18"city""北京"}print(student.keys())    # dict_keys(['name', 'age', 'city'])print(student.values())  # dict_values(['小明', 18, '北京'])print(student.items())   # dict_items([('name', '小明'), ('age', 18), ('city', '北京')])# 可以转换为列表keys_list = list(student.keys())print(keys_list)         # ['name', 'age', 'city']# 遍历for key, value in student.items():print(f"{key}{value}")

注意: 这些视图是动态的,字典变化时视图也会实时更新。

4.6 获取字典长度 len()

student = {"name""小明""age"18}print(len(student))   # 2

五、复制字典

字典是可变对象,直接赋值 dict2 = dict1 只是引用同一个对象,修改一个会影响另一个。因此需要复制。

5.1 浅拷贝 copy()

original = {"name""小明""scores": [8592]}copy_dict = original.copy()copy_dict["name"] = "小红"# 修改不可变值,不影响原字典copy_dict["scores"].append(95)      # 修改列表(可变对象),会影响原字典print(original)   # {'name': '小明', 'scores': [85, 92, 95]}print(copy_dict)  # {'name': '小红', 'scores': [85, 92, 95]}

5.2 深拷贝 deepcopy

如果希望完全独立,包括内部可变对象,需用 copy.deepcopy

import copyoriginal = {"name""小明""scores": [8592]}deep_copy = copy.deepcopy(original)deep_copy["scores"].append(95)print(original)   # {'name': '小明', 'scores': [85, 92]}print(deep_copy)  # {'name': '小明', 'scores': [85, 92, 95]}

六、实战案例

案例1:学生成绩管理系统

defstudent_scores():    scores = {}whileTrue:print("\n1. 添加/修改成绩")print("2. 删除学生")print("3. 查询成绩")print("4. 显示所有学生")print("0. 退出")        choice = input("请选择:")if choice == '1':            name = input("学生姓名:")            score = int(input("成绩:"))            scores[name] = scoreprint("已保存")elif choice == '2':            name = input("要删除的学生:")if name in scores:                scores.pop(name)print("已删除")else:print("学生不存在")elif choice == '3':            name = input("要查询的学生:")            score = scores.get(name)if score isnotNone:print(f"{name} 的成绩是 {score}")else:print("学生不存在")elif choice == '4':if scores:for name, score in scores.items():print(f"{name}{score}")else:print("暂无数据")elif choice == '0':break

案例2:统计单词出现次数

text = "apple banana apple orange banana apple"words = text.split()word_count = {}for word in words:    word_count[word] = word_count.get(word, 0) + 1print(word_count)  # {'apple': 3, 'banana': 2, 'orange': 1}

案例3:字典嵌套操作

# 存储多个学生信息students = {}students["001"] = {"name""张三""age"20}students["002"] = {"name""李四""age"21}# 修改嵌套值students["001"]["age"] = 22print(students["001"])  # {'name': '张三', 'age': 22}# 添加嵌套键值对students["002"]["score"] = 95print(students["002"])  # {'name': '李四', 'age': 21, 'score': 95}

案例4:使用 setdefault 简化计数

# 用 setdefault 实现计数word_count = {}for word in words:    word_count.setdefault(word, 0)    word_count[word] += 1# 不过通常用 get 更简洁

七、注意事项总结

  1. 1. 键必须可哈希:字典的键必须是不可变类型(整数、浮点数、字符串、元组等)。列表、字典等可变类型不能作为键。
  2. 2. 键唯一性:如果添加的键已存在,则更新其值,不会创建新项。
  3. 3. 直接访问(d[key] 键不存在会引发 KeyError,建议用 get() 安全访问。
  4. 4. pop() 与 delpop() 返回被删除的值,而 del 不返回。
  5. 5. 视图动态性keys()values()items() 返回的视图会随原字典变化,且支持集合运算(keys() 和 items())。
  6. 6. Python 3.7+ 字典有序:字典会保持插入顺序,因此 popitem() 删除的是最后插入的项。
  7. 7. 浅拷贝 vs 深拷贝:当字典值包含可变对象时,浅拷贝可能导致意外共享,必要时使用 copy.deepcopy
  8. 8. 性能:字典的查找、插入、删除操作平均时间复杂度为 O(1),非常高效。

八、总结

  • • 增加/修改d[key] = valued.update(other)
  • • 删除del d[key]d.pop(key)d.popitem()d.clear()
  • • 查找d[key]d.get(key)d.setdefault(key)key in dd.keys()d.values()d.items()
  • • 其他len(d)d.copy()copy.deepcopy(d)

掌握字典的增删改查是 Python 数据处理的基础,通过大量练习,你会越来越熟练。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-03-27 10:05:53 HTTP/2.0 GET : https://f.mffb.com.cn/a/480911.html
  2. 运行时间 : 0.216142s [ 吞吐率:4.63req/s ] 内存消耗:4,734.97kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=99c522deebb958cc4ce9982404f74adc
  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.001091s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001706s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000853s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000716s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001342s ]
  6. SELECT * FROM `set` [ RunTime:0.000716s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001444s ]
  8. SELECT * FROM `article` WHERE `id` = 480911 LIMIT 1 [ RunTime:0.001386s ]
  9. UPDATE `article` SET `lasttime` = 1774577153 WHERE `id` = 480911 [ RunTime:0.006957s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000731s ]
  11. SELECT * FROM `article` WHERE `id` < 480911 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001330s ]
  12. SELECT * FROM `article` WHERE `id` > 480911 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.024236s ]
  13. SELECT * FROM `article` WHERE `id` < 480911 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.002926s ]
  14. SELECT * FROM `article` WHERE `id` < 480911 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.003303s ]
  15. SELECT * FROM `article` WHERE `id` < 480911 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.008420s ]
0.217712s