当前位置:首页>python>Python中级工程师必会的指令

Python中级工程师必会的指令

  • 2026-06-27 23:46:52
Python中级工程师必会的指令

Python中级工程师必会的指令

进阶Python开发,掌握这些指令让你从初级迈向中级

欢迎大家关注此公众号,后台点击按钮【免费资料】可免费获取【Python入门30节课】电子书

  1. 此外小庄推荐一本适合于新手\小白入手一本 Python基础书籍,欢迎大家订阅,也感谢大家支持,我才有更新的动力

前言

作为Python中级工程师,你需要在基础知识之上,掌握更高级的编程技巧和设计模式。本文将介绍中级工程师必须掌握的指令和概念,帮助你提升代码质量和开发效率。


一、高级数据结构

1.1 collections模块

from collections import defaultdict, Counter, OrderedDict, deque, namedtuple

# defaultdict - 默认字典
dd = defaultdict(list)
dd['fruits'].append('apple')
dd['fruits'].append('banana')
dd['vegetables'].append('carrot')
print(dd)

# Counter - 计数器
text = "hello world"
counter = Counter(text)
print(counter.most_common(3))

# OrderedDict - 有序字典
od = OrderedDict()
od['first'] = 1
od['second'] = 2
od['third'] = 3

# deque - 双端队列
dq = deque([12345])
dq.appendleft(0)
dq.append(6)
dq.popleft()
dq.pop()

# namedtuple - 命名元组
Point = namedtuple('Point', ['x''y'])
p = Point(1020)
print(p.x, p.y)

1.2 heapq模块 - 堆

import heapq

# 创建堆
heap = []
heapq.heappush(heap, 3)
heapq.heappush(heap, 1)
heapq.heappush(heap, 2)

# 弹出最小值
print(heapq.heappop(heap))  # 1

# 堆化列表
data = [53142]
heapq.heapify(data)

# 获取最大/最小的n个元素
data = [53142876]
print(heapq.nlargest(3, data))   # [8, 7, 6]
print(heapq.nsmallest(3, data))  # [1, 2, 3]

# 合并多个有序迭代器
iter1 = [135]
iter2 = [246]
merged = list(heapq.merge(iter1, iter2))
print(merged)  # [1, 2, 3, 4, 5, 6]

1.3 bisect模块 - 二分查找

import bisect

# 插入元素
data = [13579]
bisect.insort(data, 4)
print(data)  # [1, 3, 4, 5, 7, 9]

# 查找插入位置
print(bisect.bisect_left(data, 4))   # 2
print(bisect.bisect_right(data, 4))  # 3

# 查找元素
print(bisect.bisect(data, 5))  # 4

二、迭代器和生成器

2.1 迭代器

# 创建迭代器
classCountDown:
def__init__(self, start):
self.start = start

def__iter__(self):
returnself

def__next__(self):
ifself.start <= 0:
raise StopIteration
self.start -= 1
returnself.start + 1

# 使用迭代器
countdown = CountDown(5)
for num in countdown:
print(num)  # 5, 4, 3, 2, 1

# 内置迭代器函数
print(next(iter([123])))

2.2 生成器

# 生成器函数
deffibonacci(n):
    a, b = 01
for _ inrange(n):
yield a
        a, b = b, a + b

# 使用生成器
for num in fibonacci(10):
print(num)

# 生成器表达式
squares = (x**2for x inrange(10))
print(list(squares))

# 生成器的优势:节省内存
import sys
list_comp = [x**2for x inrange(1000)]
gen_exp = (x**2for x inrange(1000))
print(sys.getsizeof(list_comp))  # 较大
print(sys.getsizeof(gen_exp))    # 很小

2.3 itertools模块

import itertools

# 无限迭代器
counter = itertools.count(start=1, step=2)
print(next(counter))  # 1
print(next(counter))  # 3

# cycle - 循环迭代器
cycle = itertools.cycle(['A''B''C'])
for _ inrange(6):
print(next(cycle))  # A, B, C, A, B, C

# chain - 链接迭代器
list1 = [123]
list2 = [456]
chained = list(itertools.chain(list1, list2))
print(chained)  # [1, 2, 3, 4, 5, 6]

# product - 笛卡尔积
colors = ['red''blue']
sizes = ['S''M''L']
products = list(itertools.product(colors, sizes))
print(products)

# permutations - 排列
print(list(itertools.permutations([123], 2)))

# combinations - 组合
print(list(itertools.combinations([123], 2)))

# groupby - 分组
data = [('A'1), ('A'2), ('B'3), ('B'4)]
for key, group in itertools.groupby(data, key=lambda x: x[0]):
print(key, list(group))

# accumulate - 累积
data = [12345]
print(list(itertools.accumulate(data)))  # [1, 3, 6, 10, 15]
print(list(itertools.accumulate(data, lambda x, y: x * y)))  # [1, 2, 6, 24, 120]

三、装饰器

3.1 基本装饰器

import functools
import time

# 基本装饰器
deftimer(func):
    @functools.wraps(func)
defwrapper(*args, **kwargs):
        start = time.time()
        result = func(*args, **kwargs)
        end = time.time()
print(f"{func.__name__} 执行时间: {end - start}秒")
return result
return wrapper

@timer
defslow_function():
    time.sleep(1)
return"完成"

result = slow_function()

3.2 带参数的装饰器

import functools

defrepeat(n):
defdecorator(func):
        @functools.wraps(func)
defwrapper(*args, **kwargs):
for _ inrange(n):
                result = func(*args, **kwargs)
return result
return wrapper
return decorator

@repeat(3)
defgreet(name):
print(f"Hello, {name}!")

greet("Alice")

3.3 类装饰器

import functools

classCache:
def__init__(self):
self.cache = {}

def__call__(self, func):
        @functools.wraps(func)
defwrapper(*args):
if args notinself.cache:
self.cache[args] = func(*args)
returnself.cache[args]
return wrapper

@Cache()
defexpensive_function(x):
print(f"计算 {x}...")
return x ** 2

print(expensive_function(5))  # 计算 5... 25
print(expensive_function(5))  # 25 (从缓存)

3.4 内置装饰器

# @property - 属性装饰器
classCircle:
def__init__(self, radius):
self._radius = radius

    @property
defradius(self):
returnself._radius

    @radius.setter
defradius(self, value):
if value < 0:
raise ValueError("半径不能为负数")
self._radius = value

    @property
defarea(self):
return3.14159 * self._radius ** 2

circle = Circle(5)
print(circle.radius)
print(circle.area)
circle.radius = 10

# @staticmethod - 静态方法
classMathUtils:
    @staticmethod
defadd(a, b):
return a + b

print(MathUtils.add(12))

# @classmethod - 类方法
classDate:
def__init__(self, year, month, day):
self.year = year
self.month = month
self.day = day

    @classmethod
    from_string(cls, date_string):
        year, month, day = map(int, date_string.split('-'))
return cls(year, month, day)

date = Date.from_string('2024-01-15')
print(date.year, date.month, date.day)

四、上下文管理器

4.1 使用with语句

# 文件上下文管理器
withopen('file.txt''w'as f:
    f.write('Hello')

# 自定义上下文管理器
classFileManager:
def__init__(self, filename, mode):
self.filename = filename
self.mode = mode
self.file = None

def__enter__(self):
self.file = open(self.filename, self.mode)
returnself.file

def__exit__(self, exc_type, exc_val, exc_tb):
ifself.file:
self.file.close()
returnFalse

with FileManager('file.txt''w'as f:
    f.write('Hello')

4.2 contextlib模块

from contextlib import contextmanager

# 使用装饰器创建上下文管理器
@contextmanager
deftimer():
    start = time.time()
yield
    end = time.time()
print(f"执行时间: {end - start}秒")

with timer():
    time.sleep(1)

# suppress - 抑制异常
from contextlib import suppress

with suppress(FileNotFoundError):
    os.remove('nonexistent_file.txt')

# redirect_stdout - 重定向输出
from contextlib import redirect_stdout
import io

f = io.StringIO()
with redirect_stdout(f):
print('Hello')
output = f.getvalue()
print(f'捕获的输出: {output}')

五、元编程

5.1 type()动态创建类

# 动态创建类
MyClass = type('MyClass', (object,), {'x'10})
obj = MyClass()
print(obj.x)

# 动态添加方法
defsay_hello(self):
returnf"Hello, {self.name}!"

Person = type('Person', (object,), {'say_hello': say_hello})
p = Person()
p.name = "Alice"
print(p.say_hello())

5.2 元类

# 自定义元类
classSingletonMeta(type):
    _instances = {}

def__call__(cls, *args, **kwargs):
if cls notin cls._instances:
            cls._instances[cls] = super().__call__(*args, **kwargs)
return cls._instances[cls]

classSingleton(metaclass=SingletonMeta):
pass

s1 = Singleton()
s2 = Singleton()
print(s1 is s2)  # True

5.3 __slots__优化

classPoint:
    __slots__ = ['x''y']

def__init__(self, x, y):
self.x = x
self.y = y

p = Point(12)
print(p.x, p.y)
# p.z = 3  # AttributeError

六、异步编程

6.1 asyncio基础

import asyncio

# 协程函数
asyncdefhello():
print("Hello")
await asyncio.sleep(1)
print("World")

# 运行协程
asyncio.run(hello())

# 多个协程并发
asyncdeffetch_data(url, delay):
await asyncio.sleep(delay)
returnf"{url} 数据"

asyncdefmain():
    tasks = [
        fetch_data("url1"1),
        fetch_data("url2"2),
        fetch_data("url3"3),
    ]
    results = await asyncio.gather(*tasks)
print(results)

asyncio.run(main())

6.2 异步上下文管理器

import asyncio

classAsyncResource:
asyncdef__aenter__(self):
print("获取资源")
await asyncio.sleep(0.1)
returnself

asyncdef__aexit__(self, exc_type, exc_val, exc_tb):
print("释放资源")
await asyncio.sleep(0.1)
returnFalse

asyncdefmain():
asyncwith AsyncResource() as resource:
print("使用资源")

asyncio.run(main())

6.3 异步迭代器

import asyncio

classAsyncCounter:
def__init__(self, start, end):
self.start = start
self.end = end

def__aiter__(self):
returnself

asyncdef__anext__(self):
ifself.start >= self.end:
raise StopAsyncIteration
await asyncio.sleep(0.1)
self.start += 1
returnself.start - 1

asyncdefmain():
asyncfor num in AsyncCounter(05):
print(num)

asyncio.run(main())

七、设计模式

7.1 单例模式

classSingleton:
    _instance = None

def__new__(cls, *args, **kwargs):
if cls._instance isNone:
            cls._instance = super().__new__(cls)
return cls._instance

def__init__(self, value):
self.value = value

s1 = Singleton(1)
s2 = Singleton(2)
print(s1 is s2)  # True
print(s1.value)  # 2

7.2 工厂模式

from abc import ABC, abstractmethod

classAnimal(ABC):
    @abstractmethod
defspeak(self):
pass

classDog(Animal):
defspeak(self):
return"Woof!"

classCat(Animal):
defspeak(self):
return"Meow!"

classAnimalFactory:
    @staticmethod
defcreate_animal(animal_type):
if animal_type == "dog":
return Dog()
elif animal_type == "cat":
return Cat()
else:
raise ValueError(f"Unknown animal type: {animal_type}")

animal = AnimalFactory.create_animal("dog")
print(animal.speak())

7.3 观察者模式

classSubject:
def__init__(self):
self._observers = []

defattach(self, observer):
self._observers.append(observer)

defdetach(self, observer):
self._observers.remove(observer)

defnotify(self, message):
for observer inself._observers:
            observer.update(message)

classObserver:
def__init__(self, name):
self.name = name

defupdate(self, message):
print(f"{self.name} 收到消息: {message}")

subject = Subject()
observer1 = Observer("观察者1")
observer2 = Observer("观察者2")

subject.attach(observer1)
subject.attach(observer2)
subject.notify("新消息")

7.4 策略模式

from abc import ABC, abstractmethod

classSortStrategy(ABC):
    @abstractmethod
defsort(self, data):
pass

classBubbleSort(SortStrategy):
defsort(self, data):
        n = len(data)
for i inrange(n):
for j inrange(0, n-i-1):
if data[j] > data[j+1]:
                    data[j], data[j+1] = data[j+1], data[j]
return data

classQuickSort(SortStrategy):
defsort(self, data):
iflen(data) <= 1:
return data
        pivot = data[len(data) // 2]
        left = [x for x in data if x < pivot]
        middle = [x for x in data if x == pivot]
        right = [x for x in data if x > pivot]
returnself.sort(left) + middle + self.sort(right)

classSorter:
def__init__(self, strategy):
self.strategy = strategy

defsort(self, data):
returnself.strategy.sort(data)

data = [53142]
sorter = Sorter(BubbleSort())
print(sorter.sort(data))

sorter = Sorter(QuickSort())
print(sorter.sort(data))

八、性能优化

8.1 使用内置函数

# 使用内置函数而不是手动循环
# 不推荐
total = 0
for x inrange(1000000):
    total += x

# 推荐
total = sum(range(1000000))

# 使用map和filter
numbers = [12345]
squared = list(map(lambda x: x**2, numbers))
even = list(filter(lambda x: x % 2 == 0, numbers))

8.2 使用生成器节省内存

# 不推荐:创建完整列表
defget_squares(n):
return [x**2for x inrange(n)]

# 推荐:使用生成器
defget_squares_gen(n):
for x inrange(n):
yield x**2

8.3 使用局部变量

# 不推荐
defcalculate():
    result = 0
for i inrange(1000000):
        result += math.sqrt(i)  # 每次都查找math模块
return result

# 推荐
defcalculate():
    result = 0
    sqrt = math.sqrt  # 局部变量
for i inrange(1000000):
        result += sqrt(i)
return result

8.4 使用__slots__

# 不推荐
classPoint:
def__init__(self, x, y):
self.x = x
self.y = y

# 推荐
classPoint:
    __slots__ = ['x''y']

def__init__(self, x, y):
self.x = x
self.y = y

九、类型提示

9.1 基本类型提示

from typing importListDictTupleOptionalUnion

defgreet(name: str) -> str:
returnf"Hello, {name}!"

defprocess_items(items: List[str]) -> Dict[strint]:
return {item: len(item) for item in items}

defget_user(user_id: int) -> Optional[Dict[strstr]]:
if user_id > 0:
return {"id"str(user_id), "name""User"}
returnNone

defprocess(value: Union[intstr]) -> str:
returnstr(value)

9.2 自定义类型

from typing import TypeVar, GenericList

T = TypeVar('T')

classStack(Generic[T]):
def__init__(self) -> None:
self._items: List[T] = []

defpush(self, item: T) -> None:
self._items.append(item)

defpop(self) -> T:
returnself._items.pop()

defpeek(self) -> T:
returnself._items[-1]

stack: Stack[int] = Stack()
stack.push(1)
stack.push(2)
print(stack.pop())

总结

作为Python中级工程师,掌握这些进阶技能是关键:

  1. 1. 高级数据结构 - collections、heapq、bisect
  2. 2. 迭代器和生成器 - 节省内存、惰性计算
  3. 3. 装饰器 - 代码复用、横切关注点
  4. 4. 上下文管理器 - 资源管理
  5. 5. 元编程 - 动态创建类、元类
  6. 6. 异步编程 - asyncio、协程
  7. 7. 设计模式 - 单例、工厂、观察者、策略
  8. 8. 性能优化 - 内置函数、生成器、局部变量
  9. 9. 类型提示 - 代码可读性、IDE支持

掌握这些技能,你就能写出更优雅、更高效的Python代码。


关注我,获取更多Python技术干货!

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-07-03 00:54:33 HTTP/2.0 GET : https://f.mffb.com.cn/a/500511.html
  2. 运行时间 : 0.430496s [ 吞吐率:2.32req/s ] 内存消耗:5,026.27kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=19a9fbf9de6989370ad126adce53538f
  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.000573s ] 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.001910s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.011496s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000695s ]
  6. SELECT * FROM `set` [ RunTime:0.006173s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000811s ]
  8. SELECT * FROM `article` WHERE `id` = 500511 LIMIT 1 [ RunTime:0.042873s ]
  9. UPDATE `article` SET `lasttime` = 1783011273 WHERE `id` = 500511 [ RunTime:0.030538s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.006067s ]
  11. SELECT * FROM `article` WHERE `id` < 500511 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.028669s ]
  12. SELECT * FROM `article` WHERE `id` > 500511 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.024637s ]
  13. SELECT * FROM `article` WHERE `id` < 500511 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.047384s ]
  14. SELECT * FROM `article` WHERE `id` < 500511 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.072450s ]
  15. SELECT * FROM `article` WHERE `id` < 500511 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.086430s ]
0.432173s