当前位置:首页>python>Python学习--TypeError 详解

Python学习--TypeError 详解

  • 2026-06-22 12:54:21
Python学习--TypeError 详解

一、什么是 TypeError?

TypeError 是 Python 中当操作或函数应用于不适当类型的对象时抛出的异常。这是 Python 中最常见的异常之一,通常发生在尝试对不同类型的数据执行操作时。

二、TypeError 的常见场景

1. 不同类型之间的无效操作

def invalid_operations():    """不同类型之间的无效操作"""    # 字符串和整数相加    try:        result = "Hello" + 123    except TypeError as e:        print(f"错误: {e}")  # can only concatenate str (not "int") to str    # 列表和整数相加    try:        result = [123] + 4    except TypeError as e:        print(f"错误: {e}")  # can only concatenate list (not "int") to list    # 数字和字符串相乘    try:        result = "abc" * "3"    except TypeError as e:        print(f"错误: {e}")  # can't multiply sequence by non-int of type 'str'invalid_operations()

2. 调用不可调用对象

def non_callable():    """调用不可调用对象"""    # 整数不可调用    x = 10    try:        x()    except TypeError as e:        print(f"错误: {e}")  # 'int' object is not callable    # 列表不可调用    my_list = [123]    try:        my_list()    except TypeError as e:        print(f"错误: {e}")  # 'list' object is not callable    # 字符串不可调用    name = "Alice"    try:        name()    except TypeError as e:        print(f"错误: {e}")  # 'str' object is not callablenon_callable()

3. 参数数量错误

def argument_count():    """参数数量错误"""    def greet(name):        return f"Hello, {name}"    # 参数太少    try:        greet()    except TypeError as e:        print(f"错误: {e}")  # missing 1 required positional argument: 'name'    # 参数太多    try:        greet("Alice""Bob")    except TypeError as e:        print(f"错误: {e}")  # takes 1 positional argument but 2 were givenargument_count()

4. 关键字参数错误

def keyword_arguments():    """关键字参数错误"""    def person_info(name, age):        return f"{name} is {age} years old"    # 错误的关键字参数    try:        person_info(name="Alice", years=25)    except TypeError as e:        print(f"错误: {e}")  # got an unexpected keyword argument 'years'    # 正确的调用    print(person_info(name="Alice", age=25))  # Alice is 25 years oldkeyword_arguments()

三、TypeError 的触发场景

1. 迭代非可迭代对象

def iteration_errors():    """迭代非可迭代对象"""    # 整数不可迭代    try:        for i in 123:            print(i)    except TypeError as e:        print(f"错误: {e}")  # 'int' object is not iterable    # 浮点数不可迭代    try:        for i in 3.14:            print(i)    except TypeError as e:        print(f"错误: {e}")  # 'float' object is not iterable    # None 不可迭代    try:        for i in None:            print(i)    except TypeError as e:        print(f"错误: {e}")  # 'NoneType' object is not iterableiteration_errors()

2. 索引非序列对象

def indexing_errors():    """索引非序列对象"""    # 整数不可索引    x = 123    try:        print(x[0])    except TypeError as e:        print(f"错误: {e}")  # 'int' object is not subscriptable    # 浮点数不可索引    y = 3.14    try:        print(y[0])    except TypeError as e:        print(f"错误: {e}")  # 'float' object is not subscriptable    # 字典可以使用键索引,但不能用数字索引    d = {'a'1'b'2}    try:        print(d[0])  # KeyError,不是 TypeError    except KeyError:        print("键不存在")indexing_errors()

3. 类型转换错误

def conversion_errors():    """类型转换错误"""    # 字符串转整数(包含非数字字符)    try:        num = int("abc")    except ValueError as e:        print(f"ValueError: {e}")  # 这是 ValueError    # 列表转整数(不合适的类型)    try:        num = int([123])    except TypeError as e:        print(f"TypeError: {e}")  # int() argument must be a string, a bytes-like object or a number, not 'list'    # 字典转整数    try:        num = int({'a'1})    except TypeError as e:        print(f"TypeError: {e}")  # int() argument must be a string...conversion_errors()

4. 运算符重载问题

class MyClass:    def __init__(self, value):        self.value = valuedef operator_overload_errors():    """运算符重载问题"""    obj1 = MyClass(10)    obj2 = MyClass(20)    # 自定义类默认不支持加法    try:        result = obj1 + obj2    except TypeError as e:        print(f"错误: {e}")  # unsupported operand type(s) for +: 'MyClass' and 'MyClass'    # 实现 __add__ 方法后可以工作    class MyClassWithAdd:        def __init__(self, value):            self.value = value        def __add__(self, other):            return MyClassWithAdd(self.value + other.value)    obj3 = MyClassWithAdd(10)    obj4 = MyClassWithAdd(20)    result = obj3 + obj4    print(f"结果值: {result.value}")  # 30operator_overload_errors()

5. 内置函数参数类型错误

def builtin_function_errors():    """内置函数参数类型错误"""    # len() 需要序列类型    try:        length = len(123)    except TypeError as e:        print(f"len() 错误: {e}")  # object of type 'int' has no len()    # max() 需要可迭代对象    try:        maximum = max(123)    except TypeError as e:        print(f"max() 错误: {e}")  # 'int' object is not iterable    # sorted() 需要可迭代对象    try:        sorted_result = sorted(123)    except TypeError as e:        print(f"sorted() 错误: {e}")  # 'int' object is not iterablebuiltin_function_errors()

四、处理 TypeError 的方法

1. 使用 isinstance() 进行类型检查

def type_checking():    """使用 isinstance() 进行类型检查"""    def add_numbers(a, b):        """安全加法,只处理数字类型"""        if not isinstance(a, (intfloat)):            raise TypeError(f"a 必须是数字,得到 {type(a).__name__}")        if not isinstance(b, (intfloat)):            raise TypeError(f"b 必须是数字,得到 {type(b).__name__}")        return a + b    # 测试    print(add_numbers(1020))      # 30    print(add_numbers(10.520.5))  # 31.0    try:        print(add_numbers("10"20))    except TypeError as e:        print(f"错误: {e}")    # 更灵活的处理    def safe_add(a, b):        """尝试转换类型"""        try:            return a + b        except TypeError:            try:                return float(a) + float(b)            except (TypeError, ValueError):                return None    print(safe_add(1020))      # 30    print(safe_add("10""20"))  # 30.0    print(safe_add("abc"20))   # Nonetype_checking()

2. 使用 try-except 捕获

def catch_type_error():    """使用 try-except 捕获 TypeError"""    def process_data(data):        """处理数据,兼容多种类型"""        try:            # 尝试作为可迭代对象处理            return [x.upper() for x in data]        except TypeError:            # 如果不是可迭代对象,返回字符串的大写形式            try:                return str(data).upper()            except Exception:                return None    # 测试    print(process_data(["hello""world"]))  # ['HELLO', 'WORLD']    print(process_data("hello"))              # HELLO    print(process_data(123))                  # 123    print(process_data(None))                 # Nonecatch_type_error()

3. 使用类型注解和检查工具

from typing import UnionListAnydef type_annotations():    """使用类型注解"""    def process_items(items: Union[Liststrint]) -> List[str]:        """处理不同类型的输入"""        result = []        try:            if isinstance(items, (listtuple)):                for item in items:                    result.append(str(item))            elif isinstance(items, (strintfloat)):                result.append(str(items))            else:                raise TypeError(f"不支持的类型: {type(items).__name__}")        except TypeError as e:            print(f"处理错误: {e}")            result = []        return result    # 测试    print(process_items([123]))     # ['1', '2', '3']    print(process_items("hello"))       # ['hello']    print(process_items(123))           # ['123']    print(process_items(None))          # 处理错误: 不支持的类型: NoneTypetype_annotations()

五、常见陷阱和解决方案

1. None 类型错误

def none_type_trap():    """None 类型导致的 TypeError"""    data = None    # 错误:对 None 调用方法    try:        result = data.upper()    except AttributeError as e:        print(f"AttributeError: {e}")  # 'NoneType' object has no attribute 'upper'    # 错误:对 None 进行迭代    try:        for item in data:            print(item)    except TypeError as e:        print(f"TypeError: {e}")  # 'NoneType' object is not iterable    # 错误:对 None 进行索引    try:        print(data[0])    except TypeError as e:        print(f"TypeError: {e}")  # 'NoneType' object is not subscriptable    # 解决方案:检查 None    if data is not None:        print(data.upper())    else:        print("数据为空")    # 或使用默认值    safe_data = data or ""    print(safe_data.upper())  # 空字符串none_type_trap()

2. 函数参数类型混淆

def parameter_type_trap():    """函数参数类型混淆"""    # 错误:位置参数和关键字参数混淆    def func(a, b, c):        return a + b + c    try:        result = func(a=12, c=3)  # 位置参数不能在关键字参数之后    except SyntaxError:        print("语法错误")    # 错误:可变参数的误用    def process(*args, **kwargs):        return args, kwargs    try:        process(12, name="Alice"3)  # 关键字参数不能在位置参数之后    except SyntaxError:        print("语法错误")    # 正确用法    def safe_process(*args, **kwargs):        return args, kwargs    print(safe_process(123, name="Alice"))  # 正常parameter_type_trap()

3. 类实例的类型混淆

def class_instance_trap():    """类实例类型混淆"""    class Dog:        def bark(self):            return "Woof!"    class Cat:        def meow(self):            return "Meow!"    def make_sound(animal):        """不安全的类型处理"""        return animal.bark()  # 假设所有动物都会 bark    dog = Dog()    cat = Cat()    print(make_sound(dog))  # Woof!    try:        print(make_sound(cat))  # Cat 没有 bark 方法    except AttributeError as e:        print(f"错误: {e}")    # 解决方案:使用鸭子类型或类型检查    def safe_make_sound(animal):        if hasattr(animal, 'bark'):            return animal.bark()        elif hasattr(animal, 'meow'):            return animal.meow()        else:            raise TypeError(f"{type(animal).__name__} 不会发出声音")    print(safe_make_sound(dog))  # Woof!    print(safe_make_sound(cat))  # Meow!class_instance_trap()

六、避免 TypeError 的最佳实践

1. 使用类型检查

def best_practice_type_check():    """类型检查最佳实践"""    def process_data(data):        """处理数据,先检查类型"""        # 检查类型        if isinstance(data, (listtuple)):            return [str(x) for x in data]        elif isinstance(data, dict):            return {str(k): str(v) for k, v in data.items()}        elif isinstance(data, (strintfloat)):            return str(data)        else:            raise TypeError(f"不支持的类型: {type(data).__name__}")    # 测试    print(process_data([123]))           # ['1', '2', '3']    print(process_data({'a'1'b'2}))    # {'a': '1', 'b': '2'}    print(process_data("hello"))             # hello    print(process_data(123))                 # 123best_practice_type_check()

2. 使用鸭子类型

def best_practice_duck_typing():    """鸭子类型最佳实践"""    # 鸭子类型:如果它走起来像鸭子,叫起来像鸭子,那么它就是鸭子    def process_iterable(iterable):        """处理任何可迭代对象"""        try:            return [str(x) for x in iterable]        except TypeError:            raise TypeError(f"{type(iterable).__name__} 不是可迭代对象")    # 测试各种可迭代对象    print(process_iterable([123]))        # ['1', '2', '3']    print(process_iterable((123)))       # ['1', '2', '3']    print(process_iterable("hello"))         # ['h', 'e', 'l', 'l', 'o']    print(process_iterable(range(3)))        # ['0', '1', '2']    try:        process_iterable(123)                 # 整数不可迭代    except TypeError as e:        print(f"错误: {e}")best_practice_duck_typing()

3. 使用 functools.singledispatch

from functools import singledispatchdef best_practice_singledispatch():    """使用 singledispatch 实现多类型处理"""    @singledispatch    def process(value):        """默认处理器"""        raise TypeError(f"不支持的类型: {type(value).__name__}")    @process.register(str)    def _(value):        return f"字符串处理: {value.upper()}"    @process.register(int)    @process.register(float)    def _(value):        return f"数字处理: {value * 2}"    @process.register(list)    @process.register(tuple)    def _(value):        return f"序列处理: 长度 {len(value)}"    @process.register(dict)    def _(value):        return f"字典处理: 键数量 {len(value)}"    # 测试    print(process("hello"))        # 字符串处理: HELLO    print(process(42))             # 数字处理: 84    print(process(3.14))           # 数字处理: 6.28    print(process([123]))      # 序列处理: 长度 3    print(process({'a'1}))       # 字典处理: 键数量 1    try:        process(None)              # 不支持的类型    except TypeError as e:        print(f"错误: {e}")best_practice_singledispatch()

4. 使用协议和抽象基类

from collections.abc import Iterable, Mapping, Sequencedef best_practice_protocols():    """使用协议和抽象基类"""    def process_container(container):        """处理容器类型"""        if isinstance(container, Mapping):            return f"映射: {len(container)} 个键值对"        elif isinstance(container, Sequence):            return f"序列: 长度 {len(container)}"        elif isinstance(container, Iterable):            return f"可迭代对象"        else:            raise TypeError(f"{type(container).__name__} 不是容器类型")    # 测试    print(process_container([123]))        # 序列: 长度 3    print(process_container((12)))           # 序列: 长度 2    print(process_container("hello"))          # 序列: 长度 5    print(process_container({'a'1'b'2})) # 映射: 2 个键值对    print(process_container(range(5)))         # 序列: 长度 5    try:        process_container(123)                 # 不是容器类型    except TypeError as e:        print(f"错误: {e}")best_practice_protocols()

七、总结

TypeError 要点表格

 特性
说明
 触发条件
操作或函数应用于不适当类型的对象
常见原因
类型不匹配、调用不可调用对象、参数数量错误
 处理方法
类型检查、try-except、类型转换
 最佳实践
使用 isinstance()、鸭子类型、singledispatch
 预防措施
类型注解、单元测试、代码审查

快速检查清单

 问题
检查项
 操作数类型兼容吗?
检查 +、-、*、/ 等操作符
 对象可调用吗?
检查函数、方法、类
 参数数量正确吗?
检查函数定义
 对象可迭代吗?
检查是否实现 iter
 对象可索引吗?
检查是否实现 getitem

TypeError 是 Python 中非常常见的异常,理解其产生原因和处理方法对于编写健壮的代码至关重要。通过使用类型检查、鸭子类型、异常处理等技术,可以有效地避免和处理这类错误。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-03 16:37:11 HTTP/2.0 GET : https://f.mffb.com.cn/a/487393.html
  2. 运行时间 : 0.147423s [ 吞吐率:6.78req/s ] 内存消耗:4,514.82kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=a74d957b9139417948dd5ea777c08917
  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.000619s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000917s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000284s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000290s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000620s ]
  6. SELECT * FROM `set` [ RunTime:0.000233s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000685s ]
  8. SELECT * FROM `article` WHERE `id` = 487393 LIMIT 1 [ RunTime:0.005297s ]
  9. UPDATE `article` SET `lasttime` = 1783067831 WHERE `id` = 487393 [ RunTime:0.008690s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000252s ]
  11. SELECT * FROM `article` WHERE `id` < 487393 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000502s ]
  12. SELECT * FROM `article` WHERE `id` > 487393 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000460s ]
  13. SELECT * FROM `article` WHERE `id` < 487393 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.027940s ]
  14. SELECT * FROM `article` WHERE `id` < 487393 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.001696s ]
  15. SELECT * FROM `article` WHERE `id` < 487393 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.034989s ]
0.149018s