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

Python学习--多态详解

  • 2026-02-09 17:50:34
Python学习--多态详解

多态是面向对象编程的三大特性之一,指同一操作作用于不同的对象,可以有不同的解释,产生不同的执行结果

一、多态的基本概念

1. 什么是多态?

# 多态的核心思想:不同对象对同一消息做出不同响应class Animal:    def speak(self):        return "动物发出声音"class Dog(Animal):    def speak(self):  # 方法重写        return "汪汪!"class Cat(Animal):    def speak(self):  # 方法重写          return "喵喵!"class Duck(Animal):    def speak(self):  # 方法重写        return "嘎嘎!"# 使用多态def animal_speak(animal):    """同一个函数处理不同类型的动物"""    return animal.speak()# 创建不同动物的实例animals = [Dog(), Cat(), Duck(), Animal()]print("多态演示:")print("-" * 40)for animal in animals:    # 调用相同的方法,得到不同的结果    sound = animal_speak(animal)    print(f"{animal.__class__.__name__}{sound}")# 输出:# Dog: 汪汪!# Cat: 喵喵!# Duck: 嘎嘎!# Animal: 动物发出声音

2. 多态与继承的关系

# 多态通常基于继承,但不限于继承class Shape:    """形状基类"""    def area(self):        raise NotImplementedError("子类必须实现area方法")class Rectangle(Shape):    """矩形"""    def __init__(self, width, height):        self.width = width        self.height = height    def area(self):        return self.width * self.height    def __str__(self):        return f"矩形({self.width}x{self.height})"class Circle(Shape):    """圆形"""    def __init__(self, radius):        self.radius = radius    def area(self):        import math        return math.pi * self.radius ** 2    def __str__(self):        return f"圆形(半径{self.radius})"class Triangle(Shape):    """三角形"""    def __init__(self, base, height):        self.base = base        self.height = height    def area(self):        return 0.5 * self.base * self.height    def __str__(self):        return f"三角形(底{self.base},高{self.height})"# 多态函数:处理任何形状def calculate_total_area(shapes):    """计算多个形状的总面积"""    total = 0    for shape in shapes:        area = shape.area()  # 多态调用        total += area        print(f"{shape} 的面积: {area:.2f}")    return total# 使用print("\n多态计算面积:")print("-" * 40)shapes = [    Rectangle(53),    Circle(4),    Triangle(64)]total_area = calculate_total_area(shapes)print(f"\n所有形状的总面积: {total_area:.2f}")

二、多态的几种实现方式

1. 继承多态(最常见)

class PaymentMethod:    """支付方式基类"""    def process_payment(self, amount):        raise NotImplementedErrorclass CreditCard(PaymentMethod):    def __init__(self, card_number, expiry_date):        self.card_number = card_number        self.expiry_date = expiry_date    def process_payment(self, amount):        print(f"验证信用卡 {self.card_number[-4:]}...")        print(f"授权金额 ¥{amount:.2f}...")        return f"信用卡支付成功: ¥{amount:.2f}"class PayPal(PaymentMethod):    def __init__(self, email):        self.email = email    def process_payment(self, amount):        print(f"重定向到PayPal...")        print(f"用户 {self.email} 授权支付...")        return f"PayPal支付成功: ¥{amount:.2f}"class WeChatPay(PaymentMethod):    def process_payment(self, amount):        print("生成微信支付二维码...")        print("等待用户扫码支付...")        return f"微信支付成功: ¥{amount:.2f}"# 支付处理器(多态核心)class PaymentProcessor:    def __init__(self):        self.payments = []    def add_payment(self, payment_method, amount):        """添加支付任务"""        self.payments.append((payment_method, amount))    def process_all(self):        """处理所有支付(多态调用)"""        results = []        for payment_method, amount in self.payments:            print(f"\n处理支付: {payment_method.__class__.__name__}")            result = payment_method.process_payment(amount)  # 多态            results.append(result)        return results# 使用print("支付系统多态演示:")print("=" * 50)processor = PaymentProcessor()# 添加不同类型的支付processor.add_payment(CreditCard("1234-5678-9012-3456""12/25"), 199.99)processor.add_payment(PayPal("user@example.com"), 299.99)processor.add_payment(WeChatPay(), 99.99)# 统一处理results = processor.process_all()print("\n支付结果:")for result in results:    print(f"  ✓ {result}")

2. 鸭子类型多态(Python特色)

"""鸭子类型(Duck Typing):"如果它走起来像鸭子,叫起来像鸭子,那么它就是鸭子"Python不关心对象的类型,只关心对象是否有需要的方法"""class FileReader:    """文件读取器"""    def read(self, filename):        with open(filename, 'r', encoding='utf-8'as f:            return f.read()class StringReader:    """字符串读取器"""    def __init__(self, content):        self.content = content    def read(self, filename=None):        return self.contentclass NetworkReader:    """网络读取器"""    def read(self, url):        import urllib.request        with urllib.request.urlopen(url) as response:            return response.read().decode('utf-8')# 多态函数:不关心具体类型,只关心是否有read方法def process_data(reader, source):    """处理数据源(鸭子类型多态)"""    try:        data = reader.read(source)        # 处理数据...        lines = data.strip().split('\n')        return {            'source': source,            'length'len(data),            'lines'len(lines),            'content_preview': data[:50] + '...' if len(data) > 50 else data        }    except Exception as e:        return {'error'str(e), 'source': source}print("鸭子类型多态演示:")print("=" * 50)# 创建不同的读取器(没有共同基类)readers = [    ("文件读取器", FileReader(), "example.txt"),    ("字符串读取器", StringReader("第一行\n第二行\n第三行"), None),    ("网络读取器", NetworkReader(), "http://example.com"),]# 统一处理(多态)for name, reader, source in readers:    print(f"\n使用 {name}:")    result = process_data(reader, source)    if 'error' in result:        print(f"  错误: {result['error']}")    else:        print(f"  源: {result['source']}")        print(f"  长度: {result['length']} 字符")        print(f"  行数: {result['lines']}")        print(f"  预览: {result['content_preview']}")# 验证鸭子类型print("\n鸭子类型验证:")obj1 = FileReader()obj2 = StringReader("test")obj3 = "这不是读取器"print(f"FileReader有read方法吗? {hasattr(obj1, 'read')}")print(f"StringReader有read方法吗? {hasattr(obj2, 'read')}")print(f"字符串有read方法吗? {hasattr(obj3, 'read')}")

3. 抽象基类多态

from abc import ABC, abstractmethodclass DatabaseConnection(ABC):    """数据库连接抽象基类"""    @abstractmethod    def connect(self):        """连接数据库"""        pass    @abstractmethod    def execute_query(self, sql):        """执行查询"""        pass    @abstractmethod    def close(self):        """关闭连接"""        pass    # 模板方法    def execute_transaction(self, queries):        """执行事务(模板方法模式)"""        self.connect()        try:            results = []            for sql in queries:                result = self.execute_query(sql)  # 多态调用                results.append(result)            return results        finally:            self.close()class MySQLConnection(DatabaseConnection):    """MySQL数据库连接"""    def connect(self):        print("连接到MySQL数据库...")        return "mysql_connection"    def execute_query(self, sql):        print(f"MySQL执行: {sql}")        return {"query": sql, "rows_affected"1}    def close(self):        print("关闭MySQL连接")class PostgreSQLConnection(DatabaseConnection):    """PostgreSQL数据库连接"""    def connect(self):        print("连接到PostgreSQL数据库...")        return "postgresql_connection"    def execute_query(self, sql):        print(f"PostgreSQL执行: {sql}")        return {"query": sql, "rows": [{"id"1"name""test"}]}    def close(self):        print("关闭PostgreSQL连接")class SQLiteConnection(DatabaseConnection):    """SQLite数据库连接"""    def connect(self):        print("连接到SQLite数据库...")        return "sqlite_connection"    def execute_query(self, sql):        print(f"SQLite执行: {sql}")        return {"query": sql, "success"True}    def close(self):        print("关闭SQLite连接")# 数据库管理器(使用多态)class DatabaseManager:    def __init__(self):        self.connections = {}    def add_connection(self, name, connection):        """添加数据库连接"""        if not isinstance(connection, DatabaseConnection):            raise TypeError("必须是DatabaseConnection类型")        self.connections[name] = connection    def execute_on_all(self, sql):        """在所有数据库上执行SQL(多态)"""        results = {}        for name, connection in self.connections.items():            print(f"\n在 {name} 上执行:")            result = connection.execute_transaction([sql])            results[name] = result        return resultsprint("抽象基类多态演示:")print("=" * 50)# 创建管理器manager = DatabaseManager()# 添加不同类型的数据库连接manager.add_connection("MySQL", MySQLConnection())manager.add_connection("PostgreSQL", PostgreSQLConnection())manager.add_connection("SQLite", SQLiteConnection())# 在多态执行sql = "SELECT * FROM users"results = manager.execute_on_all(sql)print("\n执行结果:")for db_name, result in results.items():    print(f"  {db_name}{result}")

总结

多态的核心要点

 类型
特点
Python实现
 继承多态
基于继承关系
方法重写、抽象基类
 鸭子类型
不关心类型,只关心行为
检查方法是否存在
 接口多态
基于抽象接口
ABC模块、Protocol
 参数多态
泛型编程
TypeVar、Generic

多态的实现方式

  1. 方法重写:子类重写父类方法

  2. 抽象基类:使用abc模块定义接口

  3. 鸭子类型:只关心对象有什么方法

适用场景

  • ✅ 需要处理多种类型的相似操作

  • ✅ 系统需要支持扩展和插件

  • ✅ 代码需要提高复用性和灵活性

  • ✅ 实现回调机制和事件处理

Python多态的特色

  • 鸭子类型是Python的特色

  • 不需要显式接口声明

  • 动态类型系统天然支持多态

  • 结合装饰器、元类等特性更强大

请在微信客户端打开

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-09 22:17:27 HTTP/2.0 GET : https://f.mffb.com.cn/a/474573.html
  2. 运行时间 : 0.125725s [ 吞吐率:7.95req/s ] 内存消耗:4,667.41kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=d5c1ae20c9ccb786df5836023078efe5
  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.000558s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000758s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000269s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000292s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000603s ]
  6. SELECT * FROM `set` [ RunTime:0.000222s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000559s ]
  8. SELECT * FROM `article` WHERE `id` = 474573 LIMIT 1 [ RunTime:0.001727s ]
  9. UPDATE `article` SET `lasttime` = 1770646648 WHERE `id` = 474573 [ RunTime:0.004732s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000307s ]
  11. SELECT * FROM `article` WHERE `id` < 474573 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000474s ]
  12. SELECT * FROM `article` WHERE `id` > 474573 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.012540s ]
  13. SELECT * FROM `article` WHERE `id` < 474573 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.012028s ]
  14. SELECT * FROM `article` WHERE `id` < 474573 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.002169s ]
  15. SELECT * FROM `article` WHERE `id` < 474573 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.001540s ]
0.127269s