当前位置:首页>python>Python字典:键值对的"智能电话簿"

Python字典:键值对的"智能电话簿"

  • 2026-03-15 12:53:47
Python字典:键值对的"智能电话簿"

字典就像现实世界的字典一样,通过"键"快速找到对应的"值"

🎯 本章目标学完本章,你会:

  1. ✅ 理解字典的概念和特点

  2. ✅ 掌握字典的创建、访问、修改操作

  3. ✅ 熟练使用字典的各种方法

  4. ✅ 理解字典的嵌套结构

  5. ✅ 能在测试中灵活使用字典存储结构化数据


🎪 开篇:为什么需要字典?

想象一下这个场景:你需要管理测试用户的数据

没有字典的世界

# 用多个变量存储用户信息username = "张三"age = 25email = "zhangsan@example.com"phone = "13800138000"city = "北京"# 要传递用户信息?得传5个参数!def process_user(username, age, email, phone, city):    ...# 要添加新字段?得改所有相关函数!

有字典的世界

# 用一个字典存储所有用户信息user = {    "username""张三",    "age"25,    "email""zhangsan@example.com"    "phone""13800138000",    "city""北京"}# 传递用户信息?只需要传1个字典!def process_user(user_data):    name = user_data["username"]    age = user_data["age"]    ...# 要添加新字段?直接加到字典里!user["gender"] = "男"

字典让相关数据的组织变得简单


📦 什么是字典?

直观理解

字典就像一本电话簿

  • 姓名 = 键(key)

  • 电话号码 = 值(value)

  • 通过姓名快速找到电话

  • 每个人的电话可以不同

技术定义

字典是Python中的一种键值对集合

  • 无序:Python 3.7+版本会保持插入顺序

  • 可变:可以修改、添加、删除键值对

  • 键唯一:键不能重复

  • 键不可变:键必须是不可变类型(字符串、数字、元组)

  • 值任意:值可以是任意类型

五个关键特性

  1. 键值对:每个元素由键和值组成

  2. 快速查找:通过键快速找到值

  3. 键必须唯一:重复的键会覆盖

  4. 键必须不可变:不能使用列表、字典等可变类型作为键

  5. 值可以任意:可以存储任何类型的数据


🆕 创建字典:四种方法

方法1:花括号直接创建(最常用)

# 空字典empty_dict = {}empty_dict2 = dict()# 创建字典person = {    "name""张三",    "age": 25,    "city""北京"}# 测试用例字典test_case = {    "id""TC001",    "name""登录功能测试",    "priority""高",    "expected_result""登录成功",    "actual_result""登录成功"}# 接口请求数据api_request = {    "url""/api/login",    "method""POST",    "headers": {"Content-Type""application/json"},    "body": {"username""test""password""123456"}}

方法2:dict()函数创建

# 从键值对列表创建person = dict([("name""张三"), ("age", 25), ("city""北京")])# 从关键字参数创建person = dict(name="张三", age=25, city="北京")# 实战:创建测试配置test_config = dict(    base_url="https://test.example.com",    timeout=30,    retry_times=3,    browser="chrome")

方法3:字典推导式

# 创建数字平方的字典squares = {x: x**2 for x in range(16)}# {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}# 从列表创建字典keys = ["name""age""city"]values = ["张三"25"北京"]person = {k: v for k, v in zip(keys, values)}# {'name': '张三', 'age': 25, 'city': '北京'}# 实战:创建测试数据映射test_cases = ["登录测试""注册测试""支付测试"]statuses = ["passed""failed""passed"]test_results = {case: status for case, status in zip(test_cases, statuses)}# {'登录测试': 'passed', '注册测试': 'failed', '支付测试': 'passed'}

方法4:fromkeys()方法

# 创建具有相同默认值的字典keys = ["name""age""city"]default_dict = dict.fromkeys(keys, "未知")# {'name''未知''age''未知''city''未知'}# 实战:初始化测试结果test_case_ids = ["TC001""TC002""TC003""TC004"]test_results = dict.fromkeys(test_case_ids, "pending")# {'TC001''pending''TC002''pending''TC003''pending''TC004''pending'}

🔍 访问字典元素

通过键访问

person = {    "name""张三",    "age": 25,    "city""北京"}# 直接通过键访问name = person["name"]  # "张三"age = person["age"]    # 25# 访问不存在的键会报错# phone = person["phone"]  # KeyError: 'phone'# 实战:获取测试信息test_case = {    "id""TC001",    "name""登录测试",    "priority""高",    "duration": 5.2}test_id = test_case["id"]          # "TC001"test_name = test_case["name"]      # "登录测试"test_duration = test_case["duration"]  # 5.2

使用get()方法(推荐)

person = {    "name""张三",    "age": 25}# 使用get()方法访问name = person.get("name")  # "张三"phone = person.get("phone")  # None(不报错)# 设置默认值phone = person.get("phone""未知")  # "未知"city = person.get("city""北京")    # "北京"# 实战:安全获取测试配置test_config = {    "base_url""https://test.example.com",    "timeout": 30}# 安全的获取方式browser = test_config.get("browser""chrome")  # "chrome"retry = test_config.get("retry_times", 3)       # 3timeout = test_config.get("timeout", 10)        # 30

检查键是否存在

person = {"name""张三""age": 25}# 使用in检查键是否存在has_name = "name" in person     # Truehas_phone = "phone" in person   # Falsehas_not_phone = "phone" not in person  # True# 使用keys()方法获取所有键keys = person.keys()  # dict_keys(['name', 'age'])# 实战:检查测试字段test_case = {    "id""TC001",    "name""登录测试",    "priority""高"}# 检查必要字段required_fields = ["id""name""priority""expected"]for field in required_fields:    if field not in test_case:        print(f"⚠️ 缺少必要字段: {field}")

获取所有键、值、键值对

person = {    "name""张三",    "age": 25,    "city""北京"}# 获取所有键keys = person.keys()  # dict_keys(['name', 'age', 'city'])keys_list = list(keys)  # ['name', 'age', 'city']# 获取所有值values = person.values()  # dict_values(['张三', 25, '北京'])values_list = list(values)  # ['张三', 25, '北京']# 获取所有键值对items = person.items()  # dict_items([('name', '张三'), ('age', 25), ('city', '北京')])items_list = list(items)  # [('name', '张三'), ('age', 25), ('city', '北京')]# 实战:分析测试结果test_results = {    "登录测试""passed",    "注册测试""failed",    "支付测试""passed",    "搜索测试""passed"}# 获取所有测试名称test_names = list(test_results.keys())# ['登录测试', '注册测试', '支付测试', '搜索测试']# 获取所有测试结果results = list(test_results.values())# ['passed', 'failed', 'passed', 'passed']# 统计通过数passed_count = results.count("passed")  # 3total = len(results)  # 4pass_rate = passed_count / total * 100print(f"通过率: {pass_rate:.1f}%")  # 75.0%

✏️ 修改字典元素

修改现有值

person = {    "name""张三",    "age": 25,    "city""北京"}# 直接修改person["age"] = 26person["city"] = "上海"# 批量修改person.update({"age": 27, "city""广州"})# 实战:更新测试状态test_result = {    "status""running",    "progress": 0,    "start_time""2024-01-15 10:00:00"}# 更新测试状态test_result["status"] = "completed"test_result["progress"] = 100test_result["end_time"] = "2024-01-15 10:05:30"test_result["duration"] = 5.5

添加新键值对

person = {"name""张三""age"25}# 直接添加person["city"] = "北京"person["phone"] = "13800138000"# 使用update()批量添加person.update({"email""zhangsan@example.com""gender""男"})# 使用setdefault()添加(如果键不存在)person.setdefault("country""中国")# 实战:添加测试信息test_case = {    "id""TC001",    "name""登录测试"}# 添加更多信息test_case["priority"] = "高"test_case["author"] = "张三"test_case["create_date"] = "2024-01-15"# 添加测试步骤test_case["steps"] = [    "打开登录页面",    "输入用户名",    "输入密码",    "点击登录按钮"]

❌ 删除字典元素

del语句

person = {    "name""张三",    "age"25,    "city""北京",    "phone""13800138000"}# 删除指定键del person["phone"]  # 删除phone键# 结果:{'name': '张三', 'age': 25, 'city': '北京'}# 删除整个字典# del person  # 字典被删除,不能再访问# 实战:清理测试数据test_data = {    "user_id"123,    "username""test",    "password""secret",    "token""abc123",    "session_id""xyz789"}# 删除敏感信息del test_data["password"]del test_data["token"]del test_data["session_id"]# 结果:{'user_id': 123, 'username': 'test'}

pop()方法

person = {    "name""张三",    "age": 25,    "city""北京"}# 删除指定键并返回值age = person.pop("age")  # 返回25,person变成{'name': '张三', 'city': '北京'}# 指定默认值(键不存在时返回默认值)phone = person.pop("phone""未知")  # 返回"未知",person不变# 实战:处理测试结果test_results = {    "登录测试""passed",    "注册测试""failed",    "支付测试""pending"}# 取出并处理完成的测试completed_test = test_results.pop("登录测试")print(f"处理完成的测试: 登录测试 - {completed_test}")# test_results变成{'注册测试': 'failed', '支付测试': 'pending'}

popitem()方法

person = {    "name""张三",    "age"25,    "city""北京"}# 删除最后一个键值对(Python 3.7+)key, value = person.popitem()  # 返回('city', '北京')# person变成{'name': '张三', 'age': 25}# 实战:后进先出处理测试队列test_queue = {    "TC001""pending",    "TC002""pending",    "TC003""pending"}# 处理最后一个添加的测试test_id, status = test_queue.popitem()print(f"处理测试: {test_id}")  # TC003

clear()方法

person = {    "name""张三",    "age"25,    "city""北京"}# 清空所有键值对person.clear()  # {}# 实战:重置测试环境test_session = {    "current_user""张三",    "token""abc123",    "permissions": ["read""write"],    "settings": {"theme""dark"}}test_session.clear()  # 清空会话数据print(f"会话已重置: {test_session}")  # {}

🔄 遍历字典

遍历键

person = {    "name""张三",    "age"25,    "city""北京"}# 遍历键for key in person:    print(f"键: {key}")# 使用keys()方法for key in person.keys():    print(f"键: {key}")# 实战:遍历测试配置test_config = {    "base_url""https://test.example.com",    "timeout"30,    "retry_times"3,    "browser""chrome"}print("测试配置检查:")for key in test_config:    print(f"  - {key}")

遍历值

person = {    "name""张三",    "age"25,    "city""北京"}# 遍历值for value in person.values():    print(f"值: {value}")# 实战:遍历测试结果test_results = {    "登录测试""passed",    "注册测试""failed",    "支付测试""passed"}print("测试结果:")for result in test_results.values():    status = "✅" if result == "passed" else "❌"    print(f"  {status}{result}")

遍历键值对

person = {    "name""张三",    "age"25,    "city""北京"}# 遍历键值对for key, value in person.items():    print(f"{key}{value}")# 实战:生成测试报告test_results = {    "登录测试""passed",    "注册测试""failed"    "支付测试""passed",    "搜索测试""passed"}print("测试报告:")for test_name, result in test_results.items():    status = "✅" if result == "passed" else "❌"    print(f"{status}{test_name}{result}")

带索引的遍历

person = {    "name""张三",    "age"25,    "city""北京"}# 使用enumerate()获取索引for i, (key, value) in enumerate(person.items(), 1):    print(f"{i}{key}{value}")# 实战:编号测试用例test_cases = {    "TC001""登录测试",    "TC002""注册测试",    "TC003""支付测试"}print("测试用例列表:")for i, (test_id, test_name) in enumerate(test_cases.items(), 1):    print(f"{i}{test_id}{test_name}")

🎯 字典的常用方法

setdefault():安全设置默认值

# 基本用法person = {"name""张三""age": 25}# 如果键不存在,设置默认值city = person.setdefault("city""北京")  # 返回"北京",并设置city="北京"# 如果键存在,返回现有值age = person.setdefault("age", 30)  # 返回25,不修改# 实战:初始化测试计数器test_counters = {}# 统计不同状态的测试数量test_results = ["passed""failed""passed""passed""failed""error"]for result in test_results:    # 如果结果类型不存在,初始化为0,然后加1    test_counters.setdefault(result, 0)    test_counters[result] += 1print(test_counters)  # {'passed': 3, 'failed': 2, 'error': 1}

update():批量更新

person = {"name""张三""age"25}# 用另一个字典更新person.update({"age"26"city""北京"})# 结果:{'name''张三''age'26'city''北京'}# 用键值对列表更新person.update([("gender""男"), ("phone""13800138000")])# 用关键字参数更新person.update(email="zhangsan@example.com", country="中国")# 实战:合并测试配置base_config = {    "base_url""https://example.com",    "timeout"30}env_config = {    "base_url""https://test.example.com",    "retry_times"3}# 合并配置,后面的会覆盖前面的base_config.update(env_config)# 结果:{'base_url''https://test.example.com''timeout'30'retry_times'3}

copy():复制字典

# 浅拷贝original = {"name""张三""scores": [859088]}copied = original.copy()# 修改原始字典original["name"] = "李四"original["scores"].append(95)print(original)  # {'name': '李四', 'scores': [85, 90, 88, 95]}print(copied)    # {'name': '张三', 'scores': [85, 90, 88, 95]}# 注意:列表是共享的,修改会影响两个字典# 实战:创建测试模板test_template = {    "status""pending",    "start_time"None,    "end_time"None,    "duration"0}# 创建多个测试实例test1 = test_template.copy()test2 = test_template.copy()test3 = test_template.copy()test1["status"] = "running"test2["status"] = "pending"test3["status"] = "completed"print(f"测试1: {test1}")print(f"测试2: {test2}")print(f"测试3: {test3}")

字典推导式

# 基本推导式squares = {x: x**2 for x in range(1, 6)}# {1: 1, 2: 4, 3: 9, 4: 16, 5: 25}# 带条件的推导式even_squares = {x: x**2 for x in range(1, 11) if x % 2 == 0}# {2: 4, 4: 16, 6: 36, 8: 64, 10: 100}# 键值转换person = {"name""张三""age": 25}upper_case = {k.upper(): v for k, v in person.items()}# {'NAME': '张三', 'AGE': 25}# 实战:转换测试结果格式test_results = {    "登录测试""passed",    "注册测试""failed",    "支付测试""passed"}# 转换状态为图标formatted_results = {    test: "✅ 通过" if status == "passed" else "❌ 失败"    for test, status in test_results.items()}# {'登录测试': '✅ 通过', '注册测试': '❌ 失败', '支付测试': '✅ 通过'}# 筛选通过的测试passed_tests = {    test: status    for test, status in test_results.items()    if status == "passed"}# {'登录测试': 'passed', '支付测试': 'passed'}

🎪 嵌套字典

字典中嵌套字典

# 嵌套字典company = {    "employee1": {        "name""张三",        "age": 25,        "position""工程师"    },    "employee2": {        "name""李四"        "age": 30,        "position""经理"    },    "employee3": {        "name""王五",        "age": 28,        "position""设计师"    }}# 访问嵌套字典employee1_name = company["employee1"]["name"]  # "张三"employee2_position = company["employee2"]["position"]  # "经理"# 实战:测试用例管理test_suite = {    "login": {        "id""TC001",        "name""登录功能测试",        "priority""高",        "steps": ["输入用户名""输入密码""点击登录"],        "expected""登录成功"    },    "register": {        "id""TC002"        "name""注册功能测试",        "priority""中",        "steps": ["填写信息""提交表单""验证邮箱"],        "expected""注册成功"    },    "payment": {        "id""TC003",        "name""支付功能测试"        "priority""高",        "steps": ["选择商品""填写支付信息""确认支付"],        "expected""支付成功"    }}# 获取登录测试的步骤login_steps = test_suite["login"]["steps"]login_priority = test_suite["login"]["priority"]

字典中嵌套列表

# 字典中嵌套列表student = {    "name""张三",    "age"20,    "courses": ["数学""物理""化学""英语"],    "scores": [85908892]}# 访问嵌套列表first_course = student["courses"][0]  # "数学"average_score = sum(student["scores"]) / len(student["scores"])  # 88.75# 实战:测试执行记录test_execution = {    "test_id""TC001",    "test_name""登录测试",    "status""passed",    "durations": [1.21.51.31.41.6],    "errors": [],    "screenshots": [        "screenshot_1.png",        "screenshot_2.png",        "screenshot_3.png"    ]}# 计算平均执行时间avg_duration = sum(test_execution["durations"]) / len(test_execution["durations"])print(f"平均执行时间: {avg_duration:.2f}秒")# 检查是否有错误has_errors = len(test_execution["errors"]) > 0print(f"是否有错误: {has_errors}")

多层嵌套

# 多层嵌套数据结构test_environment = {    "dev": {        "database": {            "host""localhost",            "port": 3306,            "name""test_db"        },        "api": {            "base_url""https://dev.example.com",            "timeout": 30        },        "users": [            {"username""dev_user1""role""admin"},            {"username""dev_user2""role""tester"}        ]    },    "staging": {        "database": {            "host""staging.db.example.com",            "port": 3306,            "name""staging_db"        },        "api": {            "base_url""https://staging.example.com",            "timeout": 60        },        "users": [            {"username""stage_user1""role""admin"},            {"username""stage_user2""role""tester"},            {"username""stage_user3""role""viewer"}        ]    }}# 访问多层嵌套数据dev_db_host = test_environment["dev"]["database"]["host"]  # "localhost"staging_timeout = test_environment["staging"]["api"]["timeout"]  # 60first_staging_user = test_environment["staging"]["users"][0]["username"]  # "stage_user1"

🧩 总结:字典的常用操作

操作

方法/语法

示例

结果

创建

{}或 dict()

{"a": 1, "b": 2}

{"a": 1, "b": 2}

访问

dict[key]或 dict.get(key)

dict["a"]

1

添加/修改

dict[key] = value

dict["c"] = 3

添加键值对

删除

delpop()popitem()clear()

dict.pop("a")

删除键"a"

检查键

key in dict

"a" in dict

True/False

获取键

dict.keys()

list(dict.keys())

键列表

获取值

dict.values()

list(dict.values())

值列表

获取键值对

dict.items()

list(dict.items())

键值对列表

长度

len(dict)

len({"a":1})

1

更新

dict.update()

dict.update({"b":2})

合并字典

设置默认值

dict.setdefault()

dict.setdefault("c", 0)

设置默认值

复制

dict.copy()

new = dict.copy()

浅拷贝


🎉 恭喜!字典掌握完成现在你已经学会了Python中另一个极其重要的数据结构!

关键收获

  1. ✅ 创建字典:四种方法创建字典

  2. ✅ 访问元素:通过键快速访问值

  3. ✅ 修改字典:增、删、改、查各种操作

  4. ✅ 遍历字典:遍历键、值、键值对

  5. ✅ 字典方法:丰富的内置方法

  6. ✅ 嵌套字典:处理复杂数据结构

  7. ✅ 实战应用:在测试中灵活使用字典

字典是自动化测试的核心,你会经常用它来:

  • 存储测试配置

  • 管理测试用例

  • 处理接口请求/响应

  • 组织测试数据

  • 记录测试结果

下一章预告:元组和集合

准备好了吗?让我们继续前进!🚀

记住:字典要多用才能掌握。尝试用字典改写你之前的代码,看看能不能变得更结构化、更易维护。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-03-28 07:51:43 HTTP/2.0 GET : https://f.mffb.com.cn/a/478640.html
  2. 运行时间 : 0.149218s [ 吞吐率:6.70req/s ] 内存消耗:5,195.55kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=494b9b3784d333b7242a2e659914d4ed
  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.000395s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000549s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000261s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000258s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000508s ]
  6. SELECT * FROM `set` [ RunTime:0.000220s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000557s ]
  8. SELECT * FROM `article` WHERE `id` = 478640 LIMIT 1 [ RunTime:0.009491s ]
  9. UPDATE `article` SET `lasttime` = 1774655503 WHERE `id` = 478640 [ RunTime:0.002817s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000300s ]
  11. SELECT * FROM `article` WHERE `id` < 478640 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000691s ]
  12. SELECT * FROM `article` WHERE `id` > 478640 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000923s ]
  13. SELECT * FROM `article` WHERE `id` < 478640 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.004613s ]
  14. SELECT * FROM `article` WHERE `id` < 478640 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.016560s ]
  15. SELECT * FROM `article` WHERE `id` < 478640 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.003557s ]
0.150701s