当前位置:首页>python>【从零开始学Python】篇11-面向对象-基础概念

【从零开始学Python】篇11-面向对象-基础概念

  • 2026-07-02 16:44:43
【从零开始学Python】篇11-面向对象-基础概念

面的文章我们学了数据类型、运算、三大结构、函数、文件操作、异常处理、模块和包。你已经能写出很完整的程序了。

但你有没有发现,随着代码越来越多:

  • 数据(变量)和操作(函数)是分开的,容易混乱

  • 想模拟现实世界的东西(比如学生、汽车、银行账户),用普通变量很难表达

  • 代码复用程度不够高,改一个地方要动很多

这时候,你就需要面向对象编程了!


一、什么是面向对象?

对比一下

面向过程
面向对象
核心
函数(怎么做)
对象(谁来做)
关注点
一步步的流程
数据和行为打包在一起
举例
做番茄炒蛋:切→炒→装盘
厨师.切() → 厨师.炒() → 厨师.装盘()

通俗理解

类 = 图纸 / 模板对象 = 根据图纸造出来的实物

类:汽车的设计图纸   
↓对象:一辆辆真实的车(宝马、奥迪、特斯拉)
类定义:“有什么”和“能做什么”对象:是具体的“某一个”

二、第一个类

class Student:    """学生类"""    pass# 创建对象stu1 = Student()stu2 = Student()print(type(stu1))# <class '__main__.Student'>

一个类可以创建无数个对象,就像一张图纸可以造无数辆车。


三、类的两大核心:属性和方法

1️⃣ 属性(有什么)

属性 = 对象拥有的数据/特征

class Student:    def__init__(self, name, age):        self.name = name # 实例属性                self.age = agestu = Student("小明",18)print(stu.name) # 小明print(stu.age)# 18

2️⃣ 方法(能做什么)

方法 = 对象拥有的行为/功能

class Student:    def __init__(self, name, age):        self.name = name        self.age = age    def study(self, course):        print(f"{self.name}正在学习{course}")    def introduce(self):        print(f"我叫{self.name},今年{self.age}岁")# 使用stu = Student("小红",19)stu.study("Python")# 小红正在学习Pythonstu.introduce()# 我叫小红,今年19岁

self 代表对象本身,谁调用方法,self 就是谁。


四、__init__ 构造方法(重点)

__init__ 是Python中的构造方法,在创建对象时自动调用

class Dog:    def__init__(self, name, color):        print("正在创建一只狗...")                self.name = name        self.color = color    def bark(self):        print(f"{self.color}色的{self.name}在汪汪叫")# 创建对象时自动调用 __init__dog = Dog("旺财","黄色")dog.bark()# 黄色的旺财在汪汪叫

作用: 初始化对象的属性,每个对象创建时都有自己的“初始状态”。


五、三大特性:封装、继承、多态

这是面向对象的灵魂,也是面试常考题。

1️⃣ 封装 —— 把数据藏起来

把属性私有化,提供公开的方法来访问。

class BankAccount:    def __init__(self, owner, balance):        self.owner = owner                self.__balance = balance  # __开头表示私有属性    # 公开方法:存钱    def deposit(self, amount):        if amount >0:            self.__balance += amount            print(f"存入{amount}元,余额:{self.__balance}")        else:            print("金额无效")    # 公开方法:取钱    def withdraw(self, amount):        if 0< amount <= self.__balance:            self.__balance -= amount            print(f"取出{amount}元,余额:{self.__balance}")        else:            print("余额不足或金额无效")   # 公开方法:查询余额   def get_balance(self):       return self.__balance# 使用account = BankAccount("张三",1000)account.deposit(500)# 存入500元,余额:1500account.withdraw(200)# 取出200元,余额:1300# print(account.__balance)  # ❌ 报错,不能直接访问私有属性print(account.get_balance())# ✅ 1300,通过方法访问

为什么要封装?

  • 保护数据安全(不能随意修改)

  • 隐藏内部实现细节

  • 可以在方法中添加验证逻辑

2️⃣ 继承 —— 复用代码

子类继承父类的属性和方法,还可以增加自己的。

# 父类(基类)class Animal:    def __init__(self, name):      self.name = name    def eat(self):        print(f"{self.name}正在吃东西")    def sleep(self):        print(f"{self.name}正在睡觉")# 子类(派生类)class Dog(Animal):    def bark(self):        print(f"{self.name}在汪汪叫")    # 重写父类方法    def eat(self):        print(f"{self.name}在大口吃骨头") class Cat(Animal):     def meow(self):         print(f"{self.name}在喵喵叫")# 使用dog = Dog("旺财")dog.eat()# 旺财在大口吃骨头(重写了)dog.sleep()# 旺财正在睡觉(继承的)dog.bark()# 旺财在汪汪叫(自己的)cat = Cat("咪咪")cat.eat()# 咪咪正在吃东西(父类的)cat.meow()# 咪咪在喵喵叫

多继承(一个子类可以继承多个父类):

class Flyable:    def fly(self):        print("正在飞翔")class Swimmable:    def swim(self):        print("正在游泳")class Duck(FlyableSwimmable):    def quack(self):        print("嘎嘎叫")duck = Duck()    duck.fly()# 正在飞翔    duck.swim()# 正在游泳    duck.quack()# 嘎嘎叫

3️⃣ 多态 —— 同一个方法,不同表现

class Animal:  def sound(self):    passclass Dog(Animal):    def sound(self):        print("汪汪")class Cat(Animal):    def sound(self):        print("喵喵")class Cow(Animal):    def sound(self):        print("哞哞")def make_sound(animal):    animal.sound()# 同一个函数,传入不同对象,表现不同make_sound(Dog())# 汪汪make_sound(Cat())# 喵喵make_sound(Cow())# 哞哞

一句话理解多态:你发出“叫”的命令,狗汪汪、猫喵喵、牛哞哞。


六、特殊方法(魔法方法)

Python中形如 __xxx__ 的方法,有特殊含义。

常用魔法方法

class Person:    def__init__(self, name, age):        self.name = name                self.age = age    # 字符串表示(开发用)    def __repr__(self):        return f"Person('{self.name}', {self.age})"    # 字符串表示(用户用)    def __str__(self):        return f"姓名:{self.name},年龄:{self.age}"    # 加法    def __add__(self, other):        return self.age + other.age    # 比较大小    def __lt__(self, other):        return self.age < other.age    # 获取长度    def __len__(self):        return len(self.name)p1 = Person("张三",25)p2 = Person("李四",30)print(p1)# 姓名:张三,年龄:25print(repr(p1))# Person('张三', 25)print(p1 + p2)# 55(年龄相加)print(p1 < p2)# True(年龄比较)print(len(p1))# 2(名字长度)

七、类属性和类方法

前面学的 self.xxx 是实例属性(每个对象自己的)。下面的是类属性(所有对象共享的)。

class Student:    # 类属性(所有学生共享)        school ="第一中学"        total_count =0    def __init__(self, name):        self.name = name                Student.total_count +=1        # 每创建一个学生,总数+1        # 实例方法(需要 self)    def introduce(self):        print(f"{self.name}来自{Student.school}")    # 类方法(需要 cls)    @classmethod    def get_total_count(cls):        return cls.total_count    # 静态方法(不需要 self/cls)    @staticmethod    def is_valid_name(name):        return len(name)>=2 # 使用 stu1 = Student("小明") stu2 = Student("小红") print(Student.total_count)# 2 print(Student.get_total_count())# 2 print(Student.is_valid_name("李"))# False(太短)

八、实战案例

案例1:学生管理系统

class Student:    def __init__(self, stu_id, name, score):        self.stu_id = stu_id                self.name = name                self.score = score    def __str__(self):        return f"{self.stu_id}\t{self.name}\t{self.score}"    def update_score(self, new_score):        if 0 <= new_score <=100:            self.score = new_score            print(f"{self.name}的成绩已更新为{new_score}")        else:            print("成绩必须在0-100之间")class StudentManager:    def __init__(self):        self.students =[]    def add_student(self, stu_id, name, score):        student = Student(stu_id, name, score)        self.students.append(student)        print(f"添加学生成功:{name}")    def find_student(self, stu_id):        for stu in self.students:            if stu.stu_id == stu_id:                return stu        return None    def remove_student(self, stu_id):        stu = self.find_student(stu_id)        if stu:            self.students.remove(stu)            print(f"删除成功:{stu.name}")        else:            print("学生不存在")    def show_all(self):        if not self.students:            print("暂无学生")            return        print("学号\t姓名\t成绩")        print("-"*30)        for stu in self.students:        print(stu)    def get_average_score(self):        if not self.students:            return 0                total =sum(stu.score for stu in self.students)            return total /len(self.students)# 使用manager = StudentManager()manager.add_student("001","张三",85)manager.add_student("002","李四",92)manager.add_student("003","王五",78)manager.show_all()print(f"平均分:{manager.get_average_score():.2f}")

案例2:简单电商系统

class Product:    def __init__(self, name, price, stock):        self.name = name        self.price = price        self.stock = stock    def __str__(self):        returnf"{self.name} | ¥{self.price} | 库存{self.stock}"    def reduce_stock(self, quantity):        if quantity <= self.stock:            self.stock -= quantity            return True        return Falseclass Cart:    def __init__(self):        self.items ={}        # {product: quantity}    def add(self, product, quantity=1):        if product.stock >= quantity:            if product in self.items:                self.items[product]+= quantity            else:                self.items[product]= quantity            print(f"已添加 {quantity} 件 {product.name}")        else:            print(f"库存不足,只剩 {product.stock} 件")    def remove(self, product):        if product in self.items:            del self.items[product]            print(f"已移除 {product.name}")    def get_total(self):        total =sum(p.price * qty for p, qty in self.items.items())        return total    def show(self):        if not self.items:            print("购物车为空")            return         print("\n=== 购物车 ===")        for product, qty in self.items.items():            print(f"{product.name} x {qty} = ¥{product.price * qty}")            print(f"总计:¥{self.get_total()}")class Order:    def __init__(self, cart, customer_name):        self.customer_name = customer_name        self.total = cart.get_total()                self.items = cart.items.copy()    def confirm(self):        # 扣减库存        for product, qty in self.items.items():            product.reduce_stock(qty)            print(f"订单已确认,{self.customer_name} 需支付 ¥{self.total}")# 使用phone = Product("手机",2999,10)laptop = Product("笔记本",5999,5)cart = Cart()cart.add(phone,2)cart.add(laptop,1)cart.show()order = Order(cart,"小明")order.confirm()

案例3:简单的图形类(演示多态)

from abc import ABC, abstractmethodimport mathclass Shape(ABC):    """抽象基类"""    @abstractmethod    def area(self):    pass    @abstractmethod    def perimeter(self):        passclass Circle(Shape):    def __init__(self, radius):        self.radius = radius    def area(self):        return math.pi * self.radius **2    def perimeter(self):        return 2* math.pi * self.radiusclass Rectangle(Shape):    def __init__(self, width, height):        self.width = width                self.height = height    def area(self):        return self.width * self.height    def perimeter(self):        return 2*(self.width + self.height)class Triangle(Shape):    def __init__(self, a, b, c):        self.a, self.b, self.c = a, b, c    def area(self):# 海伦公式                s =(self.a + self.b + self.c)/2        return math.sqrt(s *(s - self.a)*(s - self.b)*(s - self.c))    def perimeter(self):        return self.a + self.b + self.c# 多态:统一接口shapes =[    Circle(5),    Rectangle(4,6),    Triangle(3,4,5)]for shape in shapes:    print(f"{shape.__class__.__name__}: 面积={shape.area():.2f}, 周长={shape.perimeter():.2f}")

九、常见错误与避坑指南

🔥 坑1:忘记 self

class Student:    def __init__(self, name):        name = name  # ❌ 忘记 self,这只是局部变量# ✅ 正确class Student:    def __init__(self, name):        self.name = name

🔥 坑2:方法定义时缺参数

class Dog:    def bark(self):# 必须要有 self        print("汪汪")dog = Dog()dog.bark()# ✅ 调用时不需要传 self,Python自动处理

🔥 坑3:类属性和实例属性混淆

class Student:        school ="一中"# 类属性    def __init__(self, name):        self.name = name          # 实例属性# 修改类属性会影响所有实例Student.school ="二中"# 修改实例属性只影响自己stu1.school ="三中"# 实际是创建了实例属性,不是修改类属性

🔥 坑4:继承时忘记调用父类 __init__

class Animal:    def __init__(self, name):        self.name = nameclass Dog(Animal):    def __init__(self, name, breed):        # ❌ 没有调用父类的 __init__                self.breed = breed# ✅ 正确class Dog(Animal):    def __init__(self, name, breed):        super().__init__(name)        # 调用父类构造                self.breed = breed

十、面向过程 vs 面向对象对比

对比项
面向过程
面向对象
数据与操作
分离(变量+函数)
封装在一起(对象)
代码组织方式
按功能划分函数
按实体划分类
复用方式
函数复用
继承+组合
修改影响
改动一处可能影响多处
封装得好,影响可控
适用场景
简单脚本、性能敏感
大型项目、多人协作
Python支持

十一、速查表

概念
代码
定义类
class Student:
构造方法
def __init__(self, name):
实例属性
self.name = name
实例方法
def study(self):
私有属性
self.__balance
继承
class Dog(Animal):
调用父类
super().__init__()
类属性
school = "一中"
类方法
@classmethod
静态方法
@staticmethod
魔法方法
__str__
__repr____add__
抽象类
class Shape(ABC):
 + @abstractmethod

写在最后

面向对象是Python进阶的重要一步,也是通往大型项目的必经之路。

今天先掌握这些:

  • 类 vs 对象

  • 属性 vs 方法

  • 封装、继承、多态(理解概念即可)

  • 能写出简单的类

记住:不要为了用面向对象而用,简单的脚本用面向过程完全没问题。但当项目变大、逻辑变复杂时,面向对象会帮你理清思路。

📌 如果觉得有用,点赞+在看+转发 给正在学Python的小伙伴!

从面向过程到面向对象,是程序员的一次思维升级。我们下期见! 👋

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-03 09:46:07 HTTP/2.0 GET : https://f.mffb.com.cn/a/494565.html
  2. 运行时间 : 0.114685s [ 吞吐率:8.72req/s ] 内存消耗:4,765.36kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=5f398b284fe00040216e93209780cd5e
  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.000587s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000953s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000437s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000628s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000702s ]
  6. SELECT * FROM `set` [ RunTime:0.000246s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000735s ]
  8. SELECT * FROM `article` WHERE `id` = 494565 LIMIT 1 [ RunTime:0.000638s ]
  9. UPDATE `article` SET `lasttime` = 1783043167 WHERE `id` = 494565 [ RunTime:0.020179s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000378s ]
  11. SELECT * FROM `article` WHERE `id` < 494565 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000697s ]
  12. SELECT * FROM `article` WHERE `id` > 494565 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.006935s ]
  13. SELECT * FROM `article` WHERE `id` < 494565 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.003423s ]
  14. SELECT * FROM `article` WHERE `id` < 494565 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.001624s ]
  15. SELECT * FROM `article` WHERE `id` < 494565 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.001184s ]
0.116308s