当前位置:首页>python>Python学习--容器方法详解

Python学习--容器方法详解

  • 2026-03-22 12:23:09
Python学习--容器方法详解

一、容器方法概述

1. 容器协议方法

 方法
作用
触发时机
类似列表行为
__len__
返回容器长度
len(obj)len(list)
__getitem__
获取元素
obj[key]list[index]
__setitem__
设置元素
obj[key] = valuelist[index] = value
__delitem__
删除元素
del obj[key]del list[index]
__iter__
返回迭代器
iter(obj)
for循环
iter(list)
__contains__
检查包含关系
item in objitem in list
__reversed__
反向迭代
reversed(obj)reversed(list)

2. 容器类型分类

# 1. 不可变容器(只读)class ImmutableContainer:    def __len__(self): ...    def __getitem__(self, key): ...    def __iter__(self): ...    def __contains__(self, item): ...# 2. 可变容器(可读写)class MutableContainer(ImmutableContainer):    def __setitem__(self, key, value): ...    def __delitem__(self, key): ...# 3. 可哈希容器(可作为字典键)class HashableContainer(ImmutableContainer):    def __hash__(self): ...

二、基础容器实现

1. 最简单的自定义列表

class SimpleList:    """最简单的自定义列表"""    def __init__(self, items=None):        self._items = list(items) if items else []    def __len__(self):        """返回长度"""        return len(self._items)    def __getitem__(self, index):        """获取元素"""        return self._items[index]    def __setitem__(self, index, value):        """设置元素"""        self._items[index] = value    def __delitem__(self, index):        """删除元素"""        del self._items[index]    def __iter__(self):        """返回迭代器"""        return iter(self._items)    def __contains__(self, item):        """检查是否包含"""        return item in self._items    def __repr__(self):        return f"SimpleList({self._items})"# 使用lst = SimpleList([12345])print(f"长度: {len(lst)}")print(f"索引2: {lst[2]}")lst[2] = 30print(f"修改后: {lst}")del lst[2]print(f"删除后: {lst}")print(f"是否包含3: {3in lst}")print("遍历:")for item in lst:    print(f"  {item}")

2. 支持切片操作

class SliceableList:    """支持切片的列表"""    def __init__(self, items=None):        self._items = list(items) if items else []    def __len__(self):        return len(self._items)    def __getitem__(self, index):        """支持整数索引和切片"""        if isinstance(index, slice):            # 返回新的实例            return SliceableList(self._items[index])        return self._items[index]    def __setitem__(self, index, value):        """支持切片赋值"""        if isinstance(index, slice):            self._items[index] = value        else:            self._items[index] = value    def __delitem__(self, index):        """支持切片删除"""        if isinstance(index, slice):            del self._items[index]        else:            del self._items[index]    def __repr__(self):        return f"SliceableList({self._items})"# 使用lst = SliceableList([12345678])print("原始:", lst)# 切片获取slice1 = lst[2:5]print("切片[2:5]:", slice1)# 切片赋值lst[1:4] = [203040]print("切片赋值后:", lst)# 切片删除del lst[2:5]print("切片删除后:", lst)

三、__len__ 方法详解

1. 基本实现

class Playlist:    """播放列表"""    def __init__(self, name):        self.name = name        self.songs = []    def add_song(self, song):        self.songs.append(song)    def __len__(self):        """返回歌曲数量"""        return len(self.songs)    def is_empty(self):        """判断是否为空"""        return len(self) == 0  # 调用 __len__# 使用playlist = Playlist("我的歌单")print(f"初始长度: {len(playlist)}")print(f"是否为空: {playlist.is_empty()}")playlist.add_song("稻香")playlist.add_song("青花瓷")print(f"添加后长度: {len(playlist)}")

2. 复杂长度计算

class Matrix:    """矩阵类"""    def __init__(self, data):        self.data = data        self.rows = len(data)        self.cols = len(data[0]) if data else 0    def __len__(self):        """返回行数"""        return self.rows    def __getitem__(self, index):        """返回行"""        return self.data[index]    @property    def size(self):        """返回总元素数"""        return self.rows * self.cols    def __repr__(self):        return f"Matrix({self.rows}x{self.cols})"# 使用matrix = Matrix([    [123],    [456],    [789]])print(f"行数: {len(matrix)}")print(f"列数: {matrix.cols}")print(f"总元素数: {matrix.size}")

四、__getitem__ 和 __setitem__ 详解

1. 支持多种键类型

class MultiKeyDict:    """支持多种键类型的字典"""    def __init__(self):        self._data = {}    def __getitem__(self, key):        """支持多种类型的键"""        print(f"获取键: {key} (类型: {type(key).__name__})")        # 处理不同类型的键        if isinstance(key, tuple):            # 元组键:组合查找            return [self._data.get(k) for k in key]        elif isinstance(key, slice):            # 切片:返回键在某个范围内的项            start, stop, step = key.indices(len(self._data))            keys = sorted(self._data.keys())[start:stop:step]            return {k: self._data[k] for k in keys}        else:            return self._data[key]    def __setitem__(self, key, value):        print(f"设置键: {key} = {value}")        if isinstance(key, tuple):            # 批量设置            for k, v in zip(key, value):                self._data[k] = v        else:            self._data[key] = value    def __delitem__(self, key):        print(f"删除键: {key}")        del self._data[key]    def __len__(self):        return len(self._data)    def __contains__(self, key):        return key in self._data# 使用d = MultiKeyDict()# 普通键d['name'] = 'Alice'd[42] = 'answer'd[3.14] = 'pi'print(d['name'])print(d[42])# 元组键d[('x''y')] = (1020)print(d[('x''y')])# 切片键d['a'] = 1d['b'] = 2d['c'] = 3d['d'] = 4print(d['b':'d'])  # 切片访问

2. 二维容器实现

class Grid:    """二维网格"""    def __init__(self, rows, cols, default=None):        self.rows = rows        self.cols = cols        self._grid = [[default for _ in range(cols)] for _ in range(rows)]    def __getitem__(self, key):        """支持 grid[row, col] 语法"""        if isinstance(key, tuple):            row, col = key            return self._grid[row][col]        return self._grid[key]  # 返回整行    def __setitem__(self, key, value):        """支持 grid[row, col] = value 语法"""        if isinstance(key, tuple):            row, col = key            self._grid[row][col] = value        else:            self._grid[key] = value    def __len__(self):        """返回行数"""        return self.rows    def __repr__(self):        return '\n'.join([' '.join(map(str, row)) for row in self._grid])# 使用grid = Grid(330)# 设置值grid[00] = 1grid[11] = 5grid[22] = 9# 获取值print(f"grid[1,1] = {grid[11]}")# 获取整行print("\n第二行:", grid[1])print("\n完整网格:")print(grid)

3. 边界检查和验证

class SafeList:    """安全的列表,带边界检查"""    def __init__(self, size, default=None):        self.size = size        self._data = [default] * size    def _validate_index(self, index):        """验证索引是否有效"""        if not isinstance(index, int):            raise TypeError("索引必须是整数")        if index < 0 or index >= self.size:            raise IndexError(f"索引 {index} 超出范围 [0, {self.size-1}]")    def __getitem__(self, index):        self._validate_index(index)        return self._data[index]    def __setitem__(self, index, value):        self._validate_index(index)        self._data[index] = value    def __len__(self):        return self.size    def __contains__(self, item):        return item in self._data# 使用safe = SafeList(5)safe[0] = 10safe[4] = 50print(f"safe[0] = {safe[0]}")try:    safe[5] = 60  # 超出范围except IndexError as e:    print(f"错误: {e}")try:    safe["1"] = 20  # 类型错误except TypeError as e:    print(f"错误: {e}")

五、__iter__ 方法详解

1. 基本迭代器实现

class Countdown:    """倒计时迭代器"""    def __init__(self, start):        self.start = start    def __iter__(self):        """返回迭代器对象"""        return CountdownIterator(self.start)    def __reversed__(self):        """反向迭代"""        return CountupIterator(self.start)class CountdownIterator:    def __init__(self, start):        self.current = start    def __iter__(self):        return self    def __next__(self):        if self.current < 0:            raise StopIteration        value = self.current        self.current -= 1        return valueclass CountupIterator:    def __init__(self, start):        self.current = 0        self.end = start    def __iter__(self):        return self    def __next__(self):        if self.current > self.end:            raise StopIteration        value = self.current        self.current += 1        return value# 使用print("倒计时:")for num in Countdown(5):    print(num, end=' ')print()print("正计时:")for num in reversed(Countdown(5)):    print(num, end=' ')print()

2. 生成器实现(更简单)

class Fibonacci:    """斐波那契数列"""    def __init__(self, max_count):        self.max_count = max_count    def __iter__(self):        """使用生成器实现迭代器"""        a, b = 01        count = 0        while count < self.max_count:            yield a            a, b = b, a + b            count += 1    def __reversed__(self):        """反向迭代(需要缓存所有值)"""        values = list(self)        return reversed(values)# 使用fib = Fibonacci(10)print("斐波那契数列:")for num in fib:    print(num, end=' ')print()print("反向:")for num in reversed(fib):    print(num, end=' ')print()

3. 树结构的迭代

class TreeNode:    """树节点"""    def __init__(self, value):        self.value = value        self.children = []    def add_child(self, child):        self.children.append(child)    def __iter__(self):        """深度优先遍历"""        yield self        for child in self.children:            yield from child    def breadth_first(self):        """广度优先遍历"""        queue = [self]        while queue:            node = queue.pop(0)            yield node            queue.extend(node.children)    def __reversed__(self):        """反向深度优先"""        for child in reversed(self.children):            yield from reversed(child)        yield self# 构建树root = TreeNode("A")b = TreeNode("B")c = TreeNode("C")d = TreeNode("D")e = TreeNode("E")root.add_child(b)root.add_child(c)b.add_child(d)b.add_child(e)print("深度优先遍历:")for node in root:    print(node.value, end=' ')print()print("广度优先遍历:")for node in root.breadth_first():    print(node.value, end=' ')print()print("反向遍历:")for node in reversed(root):    print(node.value, end=' ')print()

六、__contains__ 方法详解

1. 高效包含检查

class FastSet:    """快速集合查找"""    def __init__(self, items):        self._items = list(items)        self._index = {item: i for i, item in enumerate(items)}    def __contains__(self, item):        """O(1) 时间复杂度的包含检查"""        return item in self._index    def __len__(self):        return len(self._items)    def __getitem__(self, index):        return self._items[index]# 使用fast_set = FastSet(range(10000))import time# 快速查找start = time.perf_counter()print(9999 in fast_set)print(f"快速查找时间: {time.perf_counter() - start:.6f}秒")# 对比普通列表normal_list = list(range(10000))start = time.perf_counter()print(9999 in normal_list)print(f"普通列表查找时间: {time.perf_counter() - start:.6f}秒")

2. 区间包含检查

class Range:    """区间类"""    def __init__(self, start, end):        self.start = start        self.end = end    def __contains__(self, item):        """检查是否在区间内"""        return self.start <= item <= self.end    def __getitem__(self, index):        """支持索引访问"""        if index < 0 or index > self.end - self.start:            raise IndexError        return self.start + index    def __len__(self):        return self.end - self.start + 1# 使用r = Range(510)print(f"6 in r: {6in r}")print(f"4 in r: {4in r}")print(f"10 in r: {10in r}")for i in range(412):    print(f"{i}{'在'if i in r else'不在'}区间")

3. 多条件包含

class Criteria:    """多条件筛选"""    def __init__(self):        self.conditions = []    def add_condition(self, condition):        self.conditions.append(condition)    def __contains__(self, item):        """检查是否满足所有条件"""        return all(condition(item) for condition in self.conditions)# 使用criteria = Criteria()criteria.add_condition(lambda x: x > 0)criteria.add_condition(lambda x: x % 2 == 0)criteria.add_condition(lambda x: x < 10)numbers = [-224681012]print("满足所有条件的数:")for num in numbers:    if num in criteria:        print(f"  {num}")

七、__reversed__ 方法详解

1. 自定义反向迭代

class ReversibleList:    """支持反向迭代的列表"""    def __init__(self, items):        self._items = list(items)    def __len__(self):        return len(self._items)    def __getitem__(self, index):        return self._items[index]    def __iter__(self):        return iter(self._items)    def __reversed__(self):        """自定义反向迭代器"""        print("使用自定义反向迭代器")        for i in range(len(self) - 1, -1, -1):            yield self._items[i]    def reverse_slice(self, start, end):        """反向切片"""        return [self._items[i] for i in range(end - 1, start - 1, -1)]# 使用rl = ReversibleList([12345])print("正向:")for item in rl:    print(item, end=' ')print()print("反向:")for item in reversed(rl):    print(item, end=' ')print()print("反向切片 [1:4]:", rl.reverse_slice(14))

2. 双向迭代器

class BidirectionalIterator:    """支持双向移动的迭代器"""    def __init__(self, data):        self._data = list(data)        self._index = 0    def __iter__(self):        return self    def __next__(self):        """正向移动"""        if self._index >= len(self._data):            raise StopIteration        value = self._data[self._index]        self._index += 1        return value    def __reversed__(self):        """返回反向迭代器"""        return BidirectionalIterator(reversed(self._data))    def previous(self):        """手动向前移动"""        if self._index <= 0:            raise StopIteration        self._index -= 1        return self._data[self._index]    def current(self):        """返回当前元素"""        if 0 <= self._index < len(self._data):            return self._data[self._index]        return None# 使用bi = BidirectionalIterator([1020304050])print("正向迭代:")for item in bi:    print(item, end=' ')print()print("反向迭代:")for item in reversed(bi):    print(item, end=' ')print()

八、总结

1. 容器方法速查表

 方法
实现要求
默认行为
优化建议
__len__
必须返回整数
O(1) 时间复杂度
__getitem__
支持整数和切片
抛出 TypeError
处理负索引
__setitem__
可变容器需要
抛出 TypeError
类型检查
__delitem__
可变容器需要
抛出 TypeError
边界检查
__iter__
返回迭代器
使用 __getitem__
实现为生成器
__contains__
返回布尔值
使用 __iter__
优化查找算法
__reversed__
返回迭代器
使用 __getitem__
提供专用实现

2. 设计原则

  1. 一致性:所有方法的行为应该一致

  2. 完整性:实现完整的容器协议

  3. 效率:考虑时间复杂度和空间复杂度

  4. 友好性:提供清晰的错误信息

  5. 灵活性:支持切片和负索引

3. 常见陷阱

# 陷阱1:__len__ 返回非整数class BadLen:    def __len__(self):        return "5"  # 错误!必须返回整数# 陷阱2:__getitem__ 不处理切片class NoSlice:    def __getitem__(self, index):        if isinstance(index, slice):            raise TypeError("不支持切片")  # 应该处理切片# 陷阱3:__contains__ 效率低class SlowContains:    def __contains__(self, item):        return item in list(self)  # 创建整个列表,效率低# 陷阱4:修改时破坏迭代class ModifyDuringIter:    def __iter__(self):        for item in self._data:            yield item        self._data.clear()  # 迭代后修改,可能引起问题

4. 最佳实践

  1. 继承抽象基类:使用 collections.abc 确保实现所有必要方法

  2. 使用生成器__iter__ 用生成器实现更简单

  3. 缓存结果:对于昂贵的操作考虑缓存

  4. 提供视图:对于大容器,考虑返回视图而不是副本

  5. 文档完善:说明容器支持的操作和行为

请在微信客户端打开

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-03-27 13:23:54 HTTP/2.0 GET : https://f.mffb.com.cn/a/480006.html
  2. 运行时间 : 0.168760s [ 吞吐率:5.93req/s ] 内存消耗:5,149.28kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=db29892715946c3879f2bba39558e4a8
  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.000536s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000638s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.001090s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.004654s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000595s ]
  6. SELECT * FROM `set` [ RunTime:0.003707s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000658s ]
  8. SELECT * FROM `article` WHERE `id` = 480006 LIMIT 1 [ RunTime:0.007590s ]
  9. UPDATE `article` SET `lasttime` = 1774589034 WHERE `id` = 480006 [ RunTime:0.009617s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000311s ]
  11. SELECT * FROM `article` WHERE `id` < 480006 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.002744s ]
  12. SELECT * FROM `article` WHERE `id` > 480006 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.011371s ]
  13. SELECT * FROM `article` WHERE `id` < 480006 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.009730s ]
  14. SELECT * FROM `article` WHERE `id` < 480006 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.001136s ]
  15. SELECT * FROM `article` WHERE `id` < 480006 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.023917s ]
0.171110s