当前位置:首页>python>Python queue模块详细介绍

Python queue模块详细介绍

  • 2026-02-05 07:19:12
Python queue模块详细介绍

1. 创始时间与作者

  • 创始时间Python 的 queue 模块最早可追溯到 Python 1.5.2 版本(发布于1999年),但当时名为 Queue(Python 2.x)。在 Python 3.0(发布于2008年)中重命名为 queue

  • 核心开发者

    • Guido van Rossum:Python 语言创始人,设计了 Python 最初的多线程编程模型

    • Python 核心开发团队:由多位开发者共同维护和优化

    • 重要贡献者:包括但不限于 Tim Peters(Timsort 算法的发明者)等

  • 项目定位:Python 标准库中的线程安全队列实现,用于多线程编程中的生产者-消费者模式

2. 官方资源

  • Python 官方文档https://docs.python.org/3/library/queue.html

  • 源代码地址https://github.com/python/cpython/blob/main/Lib/queue.py

  • 相关资源

    • Python threading 模块:https://docs.python.org/3/library/threading.html

    • Python multiprocessing 模块:https://docs.python.org/3/library/multiprocessing.html

    • Python asyncio 队列:https://docs.python.org/3/library/asyncio-queue.html

3. 核心功能

4. 应用场景

1. 生产者-消费者模式
import queueimport threadingimport time# 创建队列q = queue.Queue(maxsize=10)def producer():"""生产者:生成数据放入队列"""for in range(10):item = f"产品-{i}"q.put(item)print(f"生产: {item}")time.sleep(0.1)def consumer():"""消费者:从队列取出数据处理"""while True:item = q.get()if item is None:  # 终止信号breakprint(f"消费: {item}")q.task_done()# 创建并启动线程producer_thread = threading.Thread(target=producer)consumer_thread = threading.Thread(target=consumer)producer_thread.start()consumer_thread.start()# 等待生产者完成producer_thread.join()# 发送终止信号q.put(None)consumer_thread.join()
2. 线程池任务分发
import queueimport threadingimport concurrent.futuresclass ThreadPool:def __init__(selfnum_workers):self.task_queue = queue.Queue()self.workers = []self._create_workers(num_workers)def _create_workers(selfnum_workers):for in range(num_workers):worker = threading.Thread(target=self._worker)worker.daemon = Trueworker.start()self.workers.append(worker)def _worker(self):while True:taskargskwargs = self.task_queue.get()try:task(*args**kwargs)except Exception as e:print(f"任务执行失败: {e}")finally:self.task_queue.task_done()def submit(selftask*args**kwargs):self.task_queue.put((taskargskwargs))def wait_completion(self):self.task_queue.join()# 使用示例pool = ThreadPool(4)def process_data(data):print(f"处理数据: {data}")for in range(20):pool.submit(process_datai)pool.wait_completion()
3. 优先级任务调度
import queueimport threadingimport timeclass Task:def __init__(selfpriorityname):self.priority = priorityself.name = namedef __lt__(selfother):return self.priority<other.prioritydef __repr__(self):return f"Task({self.priority}, {self.name})"# 创建优先级队列pq = queue.PriorityQueue()# 添加任务(优先级数字越小优先级越高)pq.put(Task(3"低优先级任务"))pq.put(Task(1"高优先级任务"))pq.put(Task(2"中优先级任务"))# 处理任务while not pq.empty():task = pq.get()print(f"处理: {task}")pq.task_done()
4. Web请求队列
import queueimport threadingimport requestsclass RequestQueue:def __init__(selfmax_concurrent=5):self.queue = queue.Queue()self.semaphore = threading.Semaphore(max_concurrent)self.results = []self.lock = threading.Lock()def add_request(selfurlparams=None):self.queue.put((urlparams))def worker(self):while True:try:urlparams = self.queue.get(timeout=1)except queue.Empty:breakwith self.semaphore:try:response = requests.get(urlparams=paramstimeout=5)with self.lock:self.results.append({'url'url,'status'response.status_code,'data'response.json() if response.status_code == 200 else  None                        })except Exception as e:print(f"请求失败 {url}: {e}")self.queue.task_done()def process(selfnum_workers=10):workers = []for in range(num_workers):worker = threading.Thread(target=self.worker)worker.start()workers.append(worker)# 等待所有任务完成self.queue.join()# 停止工作线程for in range(num_workers):self.queue.put((NoneNone))for worker in workers:worker.join()return self.results# 使用示例rq = RequestQueue(max_concurrent=3)urls = ["https://api.github.com/users/octocat","https://api.github.com/users/torvalds","https://api.github.com/users/guido"]for url in urls:rq.add_request(url)results = rq.process()print(f"完成 {len(results)} 个请求")

5. 底层逻辑与技术原理

核心架构
关键技术
  1. 线程同步机制

    # queue.Queue 的核心同步实现class Queue:def __init__(selfmaxsize=0):self.maxsize = maxsizeself._init(maxsize)# 互斥锁,保护队列操作self.mutex = threading.Lock()# 条件变量,用于通知队列非空self.not_empty = threading.Condition(self.mutex)# 条件变量,用于通知队列非满self.not_full = threading.Condition(self.mutex)# 条件变量,用于通知所有任务完成self.all_tasks_done = threading.Condition(self.mutex)self.unfinished_tasks = 0
  2. 阻塞与超时机制

    def put(selfitemblock=Truetimeout=None):with self.not_full:if self.maxsize>0:if not block:if self._qsize() >self.maxsize:raise Fullelif timeout is None:while self._qsize() >self.maxsize:self.not_full.wait()elif timeout<0:raise ValueError("'timeout' must be a non-negative number")else:endtime = time() +timeoutwhile self._qsize() >self.maxsize:remaining = endtime-time()if remaining<0.0:raise Fullself.not_full.wait(remaining)self._put(item)self.unfinished_tasks += 1self.not_empty.notify()
  3. 任务完成跟踪

    def task_done(self):with self.all_tasks_done:unfinished = self.unfinished_tasks-1if unfinished<0:if unfinished<0:raise ValueError('task_done() called too many times')self.all_tasks_done.notify_all()self.unfinished_tasks = unfinisheddef join(self):with self.all_tasks_done:while self.unfinished_tasks:self.all_tasks_done.wait()
  4. 不同队列类型的实现

    # FIFO 队列 - 使用 dequeclass Queue:def _init(selfmaxsize):self.queue = deque()# LIFO 队列 - 使用 listclass LifoQueue(Queue):def _init(selfmaxsize):self.queue = list()# 优先级队列 - 使用 heapqclass PriorityQueue(Queue):def _init(selfmaxsize):self.queue = []def _put(selfitem):heapq.heappush(self.queueitem)def _get(self):return heapq.heappop(self.queue)

6. 安装与配置

基础安装
# queue 是 Python 标准库的一部分,无需安装# Python 3.x 中直接导入即可# 检查 Python 版本python --version# Python 3.6+ 都包含完整的 queue 模块
导入方式
# Python 3.x 导入方式import queue# Python 2.x 导入方式(兼容性)try:import queue# Python 3except ImportError:import Queue as queue# Python 2
模块结构
# queue 模块主要类from queue import (Queue,           # FIFO队列(先进先出)LifoQueue,       # LIFO队列(后进先出,栈)PriorityQueue,   # 优先级队列SimpleQueue,     # 简单队列(Python 3.7+)Empty,           # 空队列异常Full,            # 满队列异常)
环境要求
组件最低要求推荐配置
Python 版本3.0+3.7+
操作系统任意支持 Python 的系统Linux/macOS/Windows
内存无特殊要求根据队列大小调整
线程支持需要线程支持标准 threading 模块

7. 性能指标

队列操作时间复杂度
操作QueueLifoQueuePriorityQueueSimpleQueue
put()O(1)O(1)O(log n)O(1)
get()O(1)O(1)O(log n)O(1)
qsize()O(1)O(1)O(1)O(1)
empty()O(1)O(1)O(1)O(1)
并发性能测试
import queueimport threadingimport timefrom concurrent.futures import ThreadPoolExecutordef benchmark_queue(queue_classnum_producers=3num_consumers=3num_items=10000):"""基准测试:不同队列的性能比较"""q = queue_class()results = []def producer(pid):for in range(num_items):q.put((pidi))def consumer(cid):count = 0while count<num_items*num_producers//num_consumers:q.get()q.task_done()count += 1start = time.time()# 创建生产者线程producers = []for in range(num_producers):t = threading.Thread(target=producerargs=(i,))t.start()producers.append(t)# 创建消费者线程consumers = []for in range(num_consumers):t = threading.Thread(target=consumerargs=(i,))t.start()consumers.append(t)# 等待生产者完成for in producers:t.join()# 等待消费者完成q.join()end = time.time()return {'queue_type'queue_class.__name__,'time'end-start,'throughput': (num_items*num_producers/ (end-start)    }# 测试不同队列性能queues_to_test = [queue.Queuequeue.LifoQueuequeue.PriorityQueue]for q_class in queues_to_test:result = benchmark_queue(q_classnum_items=5000)print(f"{result['queue_type']}: {result['time']:.2f}s, "f"吞吐量: {result['throughput']:.0f} 操作/秒")

8. 高级功能使用

1. 自定义队列
import queueimport heapqfrom datetime import datetimeclass TimedPriorityQueue(queue.PriorityQueue):"""带时间戳的优先级队列"""def _put(selfitem):# item: (priority, timestamp, data)entry = [item[0], item[1], item[2], self._counter]heapq.heappush(self.queueentry)self._counter += 1def get_oldest(selfmax_age_seconds=3600):"""获取超过指定时间的旧项目"""now = datetime.now().timestamp()old_items = []with self.mutex:# 临时检查队列中的项目temp_queue = list(self.queue)for entry in temp_queue:prioritytimestampdatacount = entryif now-timestamp>max_age_seconds:old_items.append((prioritytimestampdata))# 从堆中移除self.queue.remove(entry)# 重新堆化heapq.heapify(self.queue)return old_items
2. 批量操作队列
class BatchQueue(queue.Queue):"""支持批量操作的队列"""def put_batch(selfitemsblock=Truetimeout=None):"""批量放入项目"""with self.not_full:if self.maxsize>0:space_needed = len(items)if self._qsize() +space_needed>self.maxsize:if not block:raise queue.Full# 计算可用空间while self._qsize() +space_needed>self.maxsize:self.not_full.wait()for item in items:self._put(item)self.unfinished_tasks += 1self.not_empty.notify_all()def get_batch(selfbatch_size=10block=Truetimeout=None):"""批量获取项目"""items = []with self.not_empty:if not block and self._qsize() == 0:raise queue.Emptyendtime = Noneif timeout is not None:endtime = time.time() +timeout# 收集项目直到达到batch_size或超时while len(items<batch_size:if self._qsize() == 0:if timeout is None:while self._qsize() == 0:self.not_empty.wait()elif endtime is not None:remaining = endtime-time.time()if remaining<0.0:breakself.not_empty.wait(remaining)else:breakif self._qsize() >0:items.append(self._get())self.not_full.notify()if items:self.unfinished_tasks += len(items)return items
3. 监控队列
import queueimport threadingimport timefrom collections import defaultdictclass MonitoredQueue(queue.Queue):"""可监控的队列,统计使用情况"""def __init__(selfmaxsize=0):super().__init__(maxsize)self.stats = defaultdict(int)self.stats_lock = threading.Lock()self.history = []def _update_stats(selfoperation):with self.stats_lock:self.stats[operation] += 1self.history.append({'time'time.time(),'operation'operation,'size'self.qsize(),'unfinished'self.unfinished_tasks            })# 保持最近1000条记录if len(self.history>1000:self.history.pop(0)def put(selfitemblock=Truetimeout=None):super().put(itemblocktimeout)self._update_stats('put')def get(selfblock=Truetimeout=None):item = super().get(blocktimeout)self._update_stats('get')return itemdef get_stats(self):with self.stats_lock:return dict(self.stats)def get_queue_health(self):"""获取队列健康状态"""stats = self.get_stats()total_ops = sum(stats.values())if total_ops == 0:return "空闲"put_ratio = stats.get('put'0/total_opsget_ratio = stats.get('get'0/total_opscurrent_size = self.qsize()max_size = self.maxsize if self.maxsize>else float('inf')utilization = current_size/max_sizeifmax_size!float('inf'else 0return {'total_operations'total_ops,'put_ratio'put_ratio,'get_ratio'get_ratio,'current_size'current_size,'utilization'utilization,'health_status''正常' if utilization<0.8 else '警告' if utilization<0.95 else '危险'        }
4. 队列与协程集成
import asyncioimport queueimport threadingclass AsyncQueueAdapter:"""将同步queue适配到asyncio"""def __init__(selfmaxsize=0):self.sync_queue = queue.Queue(maxsize)self.loop = asyncio.get_event_loop()async def put(selfitem):"""异步放入项目"""return await self.loop.run_in_executor(Noneself.sync_queue.putitem        )async def get(self):"""异步获取项目"""return await self.loop.run_in_executor(Noneself.sync_queue.get        )async def join(self):"""异步等待所有任务完成"""while self.sync_queue.unfinished_tasks>0:await asyncio.sleep(0.1)def task_done(self):self.sync_queue.task_done()# 使用示例async def async_producer(aqcount):for in range(count):await aq.put(f"item-{i}")await asyncio.sleep(0.01)async def async_consumer(aqname):while True:try:item = await asyncio.wait_for(aq.get(), timeout=1.0)print(f"{name} 获取: {item}")aq.task_done()except asyncio.TimeoutError:breakasync def main():aq = AsyncQueueAdapter(maxsize=10)# 创建生产者和消费者任务producer_task = asyncio.create_task(async_producer(aq50))consumer_tasks = [asyncio.create_task(async_consumer(aqf"consumer-{i}"))for in range(3)    ]# 等待生产者完成await producer_task# 等待所有项目被消费awaitaq.join()# 取消消费者任务for task in consumer_tasks:task.cancel()# 等待消费者任务结束await asyncio.gather(*consumer_tasksreturn_exceptions=True)# 运行asyncio.run(main())

9. 与同类工具对比

特性queue.Queuemultiprocessing.Queueasyncio.QueueRedis Queue
进程间通信❌(仅线程)❌(仅协程)
线程安全✅(在单线程内)
网络支持✅(通过管道)
持久化
分布式
最大大小可配置可配置可配置内存/磁盘限制
性能中等非常高中等(网络开销)
复杂度中等
适用场景单进程多线程多进程异步编程分布式系统

10. 最佳实践与常见问题

1. 死锁避免
# 错误示例:可能导致死锁q1 = queue.Queue()q2 = queue.Queue()def worker1():item = q1.get()  # 等待q1# 处理item...q2.put(result)   # 可能阻塞如果q2满q1.task_done()def worker2():item = q2.get()  # 等待q2# 处理item...q1.put(result)   # 可能阻塞如果q1满q2.task_done()# 正确做法:使用超时和错误处理def safe_worker():try:item = q1.get(timeout=5.0)  # 设置超时# 处理item...try:q2.put(resulttimeout=2.0)except queue.Full:print("队列已满,处理重试逻辑")# 重试或记录日志q1.task_done()except queue.Empty:print("获取项目超时")
2. 队列大小管理
class AdaptiveQueue(queue.Queue):"""自适应队列,根据负载动态调整"""def __init__(selfinitial_maxsize=10):super().__init__(maxsize=initial_maxsize)self.adjustment_lock = threading.Lock()self.last_adjustment = time.time()self.load_history = []def monitor_and_adjust(self):"""监控队列负载并调整大小"""with self.adjustment_lock:now = time.time()# 每分钟调整一次if now self.last_adjustment<60:returncurrent_size = self.qsize()max_size = self.maxsize# 计算负载因子load_factor = current_size/max_size if max_size>else 0# 记录负载历史self.load_history.append((nowload_factor))# 保持最近100个记录if len(self.load_history>100:self.load_history.pop(0)# 动态调整队列大小if load_factor>0.8:  # 负载过高new_size = min(max_size*21000)  # 最大1000if new_size>max_size:self.maxsize = new_sizeprint(f"队列负载高({load_factor:.2f}),增加大小到{new_size}")elif load_factor<0.2 and max_size>10:  # 负载过低new_size = max(max_size//210)  # 最小10if new_size<max_size:self.maxsize = new_sizeprint(f"队列负载低({load_factor:.2f}),减少大小到{new_size}")self.last_adjustment = now
3. 优雅关闭
import signalclass GracefulQueueManager:"""优雅关闭的队列管理器"""def __init__(self):self.task_queue = queue.Queue()self.workers = []self.shutdown_requested = Falseself.shutdown_lock = threading.Lock()# 注册信号处理器signal.signal(signal.SIGINTself.signal_handler)signal.signal(signal.SIGTERMself.signal_handler)def signal_handler(selfsignumframe):"""处理关闭信号"""print(f"收到信号 {signum},正在优雅关闭...")with self.shutdown_lock:self.shutdown_requested = True# 发送终止信号给所有工作线程for in self.workers:self.task_queue.put(None)def worker(selfworker_id):"""工作线程"""print(f"工作线程 {worker_id} 启动")while True:# 检查关闭请求with self.shutdown_lock:if self.shutdown_requested:breaktry:task = self.task_queue.get(timeout=1.0)# None 是终止信号if task is None:self.task_queue.task_done()break# 执行任务task()self.task_queue.task_done()except queue.Empty:continueexcept Exception as e:print(f"工作线程 {worker_id} 异常: {e}")print(f"工作线程 {worker_id} 关闭")def start(selfnum_workers=4):"""启动工作线程"""for in range(num_workers):worker_thread = threading.Thread(target=self.worker,args=(i,),daemon=True            )worker_thread.start()self.workers.append(worker_thread)def wait_for_completion(self):"""等待所有工作完成"""self.task_queue.join()# 等待所有工作线程结束for worker in self.workers:worker.join(timeout=5.0)
4. 性能优化技巧
# 1. 批量处理减少锁竞争class BatchProcessor:def __init__(selfprocess_batch_size=100):self.queue = queue.Queue()self.batch_size = process_batch_sizeself.current_batch = []def add_item(selfitem):self.queue.put(item)def process_batch(self):"""批量处理项目"""batch = []# 收集一批项目,减少锁竞争while len(batchself.batch_size:try:item = self.queue.get_nowait()batch.append(item)except queue.Empty:breakif batch:# 批量处理self._process_items_batch(batch)# 标记所有任务完成for in batch:self.queue.task_done()def _process_items_batch(selfbatch):# 批量处理逻辑pass# 2. 使用SimpleQueue提高性能(Python 3.7+)# SimpleQueue更简单更快,但没有task_done和join方法from queue import SimpleQueuesq = SimpleQueue()  # 更快的队列实现# 3. 避免不必要的队列操作# 错误做法:频繁检查队列状态while not q.empty():  # 这行代码可能线程不安全item = q.get()process(item)# 正确做法:使用get()阻塞while True:try:item = q.get(timeout=1.0)process(item)q.task_done()except queue.Empty:break

11. 企业级应用案例

  1. Web服务器请求处理

    • Nginx/UWSGI:使用队列管理请求缓冲区

    • Django/Flask:异步任务队列(Celery底层使用类似机制)

    • 实现模式:生产者(HTTP请求接收)→ 队列 → 消费者(请求处理)

  2. 大数据处理管道

    • Apache Kafka:分布式队列系统

    • 数据流处理:ETL管道中的缓冲队列

    • 实现模式:数据源 → 队列 → 处理器 → 结果队列 → 存储

  3. 实时交易系统

    • 证券交易所:订单队列管理

    • 高频交易:低延迟消息队列

    • 实现模式:订单接收 → 验证队列 → 匹配引擎 → 执行队列

  4. 云计算任务调度

    • AWS SQS:云消息队列服务

    • Kubernetes:Pod调度队列

    • 实现模式:任务提交 → 调度队列 → 工作节点 → 结果队列


总结

Python queue 模块是多线程编程的核心基础设施,核心价值在于:

  1. 线程安全:内置锁机制确保多线程环境下的数据安全

  2. 生产者-消费者模式:简化并发编程模型

  3. 阻塞与非阻塞操作:灵活的任务调度控制

  4. 多种队列类型:满足不同场景需求(FIFO、LIFO、优先级)

技术亮点

  • 基于条件变量(Condition)的高效同步机制

  • 支持超时和阻塞控制

  • 任务完成跟踪(task_done/join)

  • 简单而强大的API设计

适用场景

  • 多线程任务调度和分发

  • 生产者-消费者模式实现

  • 线程池和工作队列管理

  • 异步处理缓冲区

  • 任务优先级调度

安装使用

# 无需安装,Python标准库import queue# 基本使用q = queue.Queue()q.put(item)item = q.get()q.task_done()q.join()

学习资源

  • 官方文档:https://docs.python.org/3/library/queue.html

  • Python并发编程指南:https://docs.python.org/3/library/concurrency.html

  • 《Python Cookbook》第12章:并发编程

  • 实战教程:Real Python多线程教程

作为Python标准库的一部分,queue模块被广泛应用于各种规模的Python项目中。它遵循 Python软件基金会许可证(PSF License),是所有Python发行版的组成部分。无论是小型脚本还是大型分布式系统,queue模块都提供了可靠、高效的线程安全队列实现。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-07 12:15:18 HTTP/2.0 GET : https://f.mffb.com.cn/a/473380.html
  2. 运行时间 : 0.141589s [ 吞吐率:7.06req/s ] 内存消耗:5,008.41kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=fac23586dc6897adf5ca7b797c15d7f5
  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.000400s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000804s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000440s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000764s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000859s ]
  6. SELECT * FROM `set` [ RunTime:0.000480s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000752s ]
  8. SELECT * FROM `article` WHERE `id` = 473380 LIMIT 1 [ RunTime:0.012328s ]
  9. UPDATE `article` SET `lasttime` = 1770437718 WHERE `id` = 473380 [ RunTime:0.009769s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000525s ]
  11. SELECT * FROM `article` WHERE `id` < 473380 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000775s ]
  12. SELECT * FROM `article` WHERE `id` > 473380 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000609s ]
  13. SELECT * FROM `article` WHERE `id` < 473380 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.022374s ]
  14. SELECT * FROM `article` WHERE `id` < 473380 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.008008s ]
  15. SELECT * FROM `article` WHERE `id` < 473380 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.017362s ]
0.143165s