当前位置:首页>python>Python3 面向对象:把代码组织得像现实世界一样

Python3 面向对象:把代码组织得像现实世界一样

  • 2026-06-28 14:53:30
Python3 面向对象:把代码组织得像现实世界一样

Python3 面向对象:把代码组织得像现实世界一样

我是陈默,一个正拼命上岸的码农。

你有没有想过,为什么现实世界这么好理解?

因为一切都是"对象"。狗有名字、有品种、会叫。车有品牌、有颜色、会跑。每个对象都有自己的属性和行为。

面向对象编程就是把这种思维搬进代码里。

今天我们用一个实际的例子,把 Python 面向对象的核心概念一次性讲清楚。


1. 类和对象:图纸和产品

类是图纸,对象是按图纸造出来的产品。

定义一个类

classDog:def__init__(self, name, breed):        self.name = name      # 属性:名字        self.breed = breed    # 属性:品种defbark(self):        print(f"{self.name}:汪汪!")definfo(self):        print(f"我是{self.name},品种是{self.breed}")

创建对象

dog1 = Dog("旺财""柴犬")dog2 = Dog("来福""金毛")dog1.info()    # 输出: 我是旺财,品种是柴犬dog2.info()    # 输出: 我是来福,品种是金毛dog1.bark()    # 输出: 旺财:汪汪!dog2.bark()    # 输出: 来福:汪汪!

同一张图纸,不同的产品。每个对象有自己的数据,共享相同的方法。

__init__ 和 self

  • __init__ 是初始化方法,创建对象时自动调用
  • self 代表对象自己,相当于"我"
# 这两行做的事情一样dog1 = Dog("旺财""柴犬")# Python 内部大概是这样:# dog1 = Dog.__new__(Dog)# Dog.__init__(dog1, "旺财", "柴犬")# self 就是 dog1

self 必须写,但调用的时候不用传。Python 自动帮你传。


2. 属性:对象的数据

实例属性:每个对象独有

classStudent:def__init__(self, name, score):        self.name = name        self.score = scores1 = Student("陈默"85)s2 = Student("小明"92)print(s1.name)     # 输出: 陈默print(s2.name)     # 输出: 小明

类属性:所有对象共享

classStudent:    school = "Python 大学"# 类属性,所有学生共享    count = 0def__init__(self, name, score):        self.name = name        self.score = score        Student.count += 1# 每创建一个学生,计数加1s1 = Student("陈默"85)s2 = Student("小明"92)print(s1.school)          # 输出: Python 大学print(s2.school)          # 输出: Python 大学print(Student.count)      # 输出: 2

实例属性是"我的",类属性是"大家的"。


3. 方法:对象的行为

实例方法

最普通的方法,第一个参数是 self

classCircle:def__init__(self, radius):        self.radius = radiusdefarea(self):return3.14 * self.radius ** 2defperimeter(self):return2 * 3.14 * self.radiusc = Circle(5)print(c.area())       # 输出: 78.5print(c.perimeter())  # 输出: 31.400000000000002

__str__:打印对象时显示什么

classStudent:def__init__(self, name, score):        self.name = name        self.score = scoredef__str__(self):returnf"{self.name}{self.score}分)"s = Student("陈默"85)print(s)    # 输出: 陈默(85分)

不加 __str__,print 输出的是 <__main__.Student object at 0x...>,没人看得懂。


4. 继承:孩子继承父母的基因

子类可以继承父类的属性和方法,还能扩展自己的。

基本继承

classAnimal:def__init__(self, name):        self.name = namedefeat(self):        print(f"{self.name}在吃东西")defsleep(self):        print(f"{self.name}在睡觉")# Dog 继承 AnimalclassDog(Animal):defbark(self):        print(f"{self.name}:汪汪!")# Cat 继承 AnimalclassCat(Animal):defmeow(self):        print(f"{self.name}:喵喵~")dog = Dog("旺财")cat = Cat("小花")dog.eat()     # 输出: 旺财在吃东西(继承来的)dog.bark()    # 输出: 旺财:汪汪!(自己的)cat.eat()     # 输出: 小花在吃东西(继承来的)cat.meow()    # 输出: 小花:喵喵~(自己的)

Dog 和 Cat 自动拥有 eat() 和 sleep(),不用重写。

方法重写(Override)

子类可以覆盖父类的方法:

classAnimal:defspeak(self):        print("...")classDog(Animal):defspeak(self):        print("汪汪!")classCat(Animal):defspeak(self):        print("喵喵~")animals = [Dog(), Cat()]for a in animals:    a.speak()# 输出:# 汪汪!# 喵喵~

同一个方法,不同的表现。这就是多态。

super():调用父类的方法

classStudent:def__init__(self, name, score):        self.name = name        self.score = scoreclassGraduateStudent(Student):def__init__(self, name, score, research):        super().__init__(name, score)    # 调用父类的 __init__        self.research = research         # 添加自己的属性definfo(self):        print(f"{self.name}{self.score}分,研究方向:{self.research}")gs = GraduateStudent("陈默"92"人工智能")gs.info()    # 输出: 陈默:92分,研究方向:人工智能

super() 让你不用重复写父类的初始化逻辑。


5. 封装:把细节藏起来

私有属性

用双下划线 __ 开头的属性,外面不能直接访问:

classBankAccount:def__init__(self, owner, balance):        self.owner = owner        self.__balance = balance    # 私有属性defdeposit(self, amount):if amount > 0:            self.__balance += amount            print(f"存入{amount}元,余额{self.__balance}元")defwithdraw(self, amount):if amount > self.__balance:            print("余额不足")elif amount > 0:            self.__balance -= amount            print(f"取出{amount}元,余额{self.__balance}元")defget_balance(self):return self.__balanceaccount = BankAccount("陈默"1000)account.deposit(500)       # 输出: 存入500元,余额1500元account.withdraw(200)      # 输出: 取出200元,余额1300元# 不能直接改余额# account.__balance = 999999    # 不管用print(account.get_balance())    # 输出: 1300

封装的核心:数据只能通过方法修改,防止外部乱改。

用 property 更优雅

classStudent:def__init__(self, name, score):        self.name = name        self.__score = score    @propertydefscore(self):return self.__score    @score.setterdefscore(self, value):ifnot0 <= value <= 100:raise ValueError("分数必须在0-100之间")        self.__score = values = Student("陈默"85)print(s.score)       # 输出: 85(像属性一样访问)s.score = 92# 调用 setter,带验证print(s.score)       # 输出: 92s.score = 150# 报错!ValueError: 分数必须在0-100之间

@property 让方法用起来像属性,但背后有验证逻辑。


6. 类方法和静态方法

类方法:操作类级别的数据

classStudent:    school = "Python 大学"    count = 0def__init__(self, name):        self.name = name        Student.count += 1    @classmethoddefget_count(cls):return cls.count    @classmethoddefchange_school(cls, new_name):        cls.school = new_names1 = Student("陈默")s2 = Student("小明")print(Student.get_count())      # 输出: 2Student.change_school("Java 大学")print(Student.school)           # 输出: Java 大学

静态方法:跟类和对象都没关系的工具

classMathTools:    @staticmethoddefadd(a, b):return a + b    @staticmethoddefis_even(n):return n % 2 == 0print(MathTools.add(35))       # 输出: 8print(MathTools.is_even(4))      # 输出: True

三种方法怎么选?

  • 需要访问实例数据 → 实例方法(self
  • 需要访问类级别的数据 → 类方法(@classmethod
  • 跟类和实例都没关系 → 静态方法(@staticmethod

7. 魔术方法:让对象更像内置类型

classScoreList:def__init__(self, scores):        self.scores = scoresdef__len__(self):return len(self.scores)def__getitem__(self, index):return self.scores[index]def__contains__(self, item):return item in self.scoresdef__str__(self):returnf"成绩列表:{self.scores}"def__add__(self, other):return ScoreList(self.scores + other.scores)scores = ScoreList([859278])print(len(scores))       # 输出: 3print(scores[0])         # 输出: 85print(92in scores)      # 输出: Trueprint(scores)            # 输出: 成绩列表:[85, 92, 78]combined = scores + ScoreList([9088])print(combined)          # 输出: 成绩列表:[85, 92, 78, 90, 88]

魔术方法让你的自定义对象用起来像列表、像数字、像字符串。


8. 实战:一个完整的类

classTodoList:"""待办事项管理器"""def__init__(self, owner):        self.owner = owner        self.__todos = []defadd(self, task):        self.__todos.append({"task": task, "done"False})        print(f"添加:{task}")defcomplete(self, index):if0 <= index < len(self.__todos):            self.__todos[index]["done"] = True            print(f"完成:{self.__todos[index]['task']}")else:            print("序号不存在")defshow(self):        print(f"\n{self.owner} 的待办:")for i, item in enumerate(self.__todos):            status = "✓"if item["done"else"○"            print(f"  {i}. [{status}{item['task']}")        pending = sum(1for t in self.__todos ifnot t["done"])        print(f"  共{len(self.__todos)}项,待完成{pending}项\n")def__len__(self):return len(self.__todos)def__str__(self):        pending = sum(1for t in self.__todos ifnot t["done"])returnf"{self.owner}的待办:{pending}项待完成"# 使用my_list = TodoList("陈默")my_list.add("学 Python 面向对象")my_list.add("写一篇公众号文章")my_list.add("跑步 5 公里")my_list.complete(0)my_list.show()print(my_list)        # 输出: 陈默的待办:2项待完成print(len(my_list))   # 输出: 3

最后

面向对象不是什么高深的东西。它就是把现实世界的思维方式搬进代码。

记住三件事:

  1. 类是图纸,对象是产品。__init__ 是初始化,self 是"我"
  2. 继承让代码复用,封装让数据安全,多态让接口统一
  3. 先写简单的类,再慢慢加继承和封装。别一开始就想太多

我的建议:

挑一个你熟悉的东西——手机、图书、订单——用类把它描述出来。给它属性,给它方法。先跑起来,再慢慢优化。

面向对象不是学出来的,是写出来的。

今天就到这里。

我是陈默,我们下期再见。


如果你觉得这篇文章有帮助,欢迎关注我。我会持续分享 Python 学习的干货。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-04 09:35:39 HTTP/2.0 GET : https://f.mffb.com.cn/a/488053.html
  2. 运行时间 : 0.101654s [ 吞吐率:9.84req/s ] 内存消耗:4,936.98kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=2022ca0b5cccbafc618439e13e28f4f2
  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.000381s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000870s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.002691s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.006555s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000528s ]
  6. SELECT * FROM `set` [ RunTime:0.000214s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000648s ]
  8. SELECT * FROM `article` WHERE `id` = 488053 LIMIT 1 [ RunTime:0.001453s ]
  9. UPDATE `article` SET `lasttime` = 1783128939 WHERE `id` = 488053 [ RunTime:0.005534s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.002625s ]
  11. SELECT * FROM `article` WHERE `id` < 488053 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.004670s ]
  12. SELECT * FROM `article` WHERE `id` > 488053 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000463s ]
  13. SELECT * FROM `article` WHERE `id` < 488053 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.001853s ]
  14. SELECT * FROM `article` WHERE `id` < 488053 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.002523s ]
  15. SELECT * FROM `article` WHERE `id` < 488053 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.004512s ]
0.103219s