当前位置:首页>python>谁懂啊!Python 多进程居然能写得又快又优雅,看完直接封神

谁懂啊!Python 多进程居然能写得又快又优雅,看完直接封神

  • 2026-02-02 21:20:37
谁懂啊!Python 多进程居然能写得又快又优雅,看完直接封神

## 使用fork创建新进程

Python的OS模块提供了一个fork()函数,该函数的作用在于程序会启动两个进程(一个父进程一个子进程)来执行从os.fork()开始的所有代码,fork()函数不需要参数,会返回一个表明是哪个进程在执行的返回值,如果返回0则表明是fork出来的子进程在执行,如果返回非0,则表明是父进程在执行

该方法仅在UNIX及类UNIX系统上行得通,包括UNIX,Linux和Mac系统

import osprint('父进程(%s)开始执行' % os.getpid())# 开始fork一个子进程# 从这行代码开始,下面代码都会被两个进程执行pid = os.fork()print('进程进入:%s' % os.getpid())# 如果pid为0,表明子进程if pid == 0:    print('子进程,其ID为 (%s), 父进程ID为 (%s)' % (os.getpid(), os.getppid()))else:    print('我 (%s) 创建的子进程ID为 (%s).' % (os.getpid(), pid))print('进程结束:%s' % os.getpid())

从pid = os.fork()之后的代码程序会分别使用父进程和子进程来执行

## 使用multiprocessing.Process创建新进程

Python在muliprocessing模块下提供了Process来创建新进程,与Thread非常类似,创建新进程有两种方式

-以指定函数作为target,创建Process对象即可创建新进程

-继承Process类,并重写它的run()方法来创建进程类,程序创建Process子类的实例作为进程

同样的Process也具有如下类似的方法和属性

- run():重写该方法可实现进程的执行体

- start():该方法用于启动进程

-join(timeout):该方法类似于线程的join()方法,当前进程必须等待被join的进程执行完毕才能继续执行

-name:该属性用于设置或访问进程的名字

-is_alive():判断进程死活

-daemon:该属性用于判断或设置进程的后台状态

-pid:返回进程ID

-authkey:返回进程的授权key

-terminate():中断该进程

### 以指定函数作为target创建进程

import multiprocessingimport os# 定义一个普通的action函数,该函数准备作为进程执行体def action(max):    for i in range(max):        print("(%s)子进程(父进程:(%s)):%d" %             (os.getpid(), os.getppid(), i))if __name__ == '__main__':    # 下面是主程序(也就是主进程)    for i in range(100):        print("(%s)主进程: %d" % (os.getpid(), i))        if i == 20:            # 创建并启动第一个进程            mp1 = multiprocessing.Process(target=action,args=(100,))            mp1.start()            # 创建并启动第一个进程            mp2 = multiprocessing.Process(target=action,args=(100,))            mp2.start()            mp2.join()    print('主进程执行完成!')

### 继承Process类创建子进程

创建步骤:

-定义继承Process的子类,重写其run()方法准备作为进程执行体

-创建Process子类的实例

-调用Process子类的实例的start()方法来启动进程

import multiprocessingimport osclass MyProcess(multiprocessing.Process):    def __init__(self, max):        self.max = max        super().__init__()    # 重写run()方法作为进程执行体    def run(self):        for i in range(self.max):            print("(%s)子进程(父进程:(%s)):%d" %                 (os.getpid(), os.getppid(), i))if __name__ == '__main__':    # 下面是主程序(也就是主进程)    for i in range(100):        print("(%s)主进程: %d" % (os.getpid(), i))        if i == 20:            # 创建并启动第一个进程            mp1 = MyProcess(100)            mp1.start()            # 创建并启动第一个进程            mp2 = MyProcess(100)            mp2.start()            mp2.join()    print('主进程执行完成!')

## Context和启动进程的方式

Python有三种启动进程的方式

-spawn:父进程会启动一个全新的Python解释器进程,这也是windows平台唯一的方式,在这种方式下,子进程只能继承那些处理run()方法所必须的资源,那些不必要的文件扫描器和handle都不会被继承,这种方式比fork或forkserver方式效率要低

-fork:父进程使用os.fork()来启动一个python解释器进程,该子进程会继承父进程的所有资源,因此它基本等效于父进程

-forkserver:用这种方式启动进程,程序会启动一个服务器进程,之后当程序再次请求启动新进程时,父进程都会链接到该服务器进程,请求由服务器进程来fork新进程,这种方式无需从父进程继承资源,跟fork一样该方式仅在UNIX系统有效

### set_start_method函数

multiprocessing模块提供了set_start_method()函数,用于设置启动继承的方式,该代码必须所有与多进程相关的代码之前

import multiprocessingimport osdef foo(q):    print('被启动的新进程: (%s)' % os.getpid())    q.put('Python')if __name__ == '__main__':    # 设置使用fork方式启动进程    multiprocessing.set_start_method('spawn')    q = multiprocessing.Queue()    # 创建进程    mp = multiprocessing.Process(target=foo, args=(q, ))    # 启动进程    mp.start()    # 获取队列中的消息     print(q.get())    mp.join()

程序的新进程想multiprocess.Queue中放入一个数据`(Python)`主进程取出该Queue中的数据,并输出该数据

### get_context函数

该方法也能设置进程启动方式,利用get_context()方法来获取Context对象,调用该方法可传入spawn、fork、forkserver字符串,Context拥有和multiprocessing相同的API

import multiprocessingimport osdef foo(q):    print('被启动的新进程: (%s)' % os.getpid())    q.put('Python')if __name__ == '__main__':    # 设置使用fork方式启动进程,并获取Context对象    ctx = multiprocessing.get_context('fork')    # 接下来就可用Context对象来代替mutliprocessing模块了    q = ctx.Queue()    # 创建进程    mp = ctx.Process(target=foo, args=(q, ))    # 启动进程    mp.start()    # 获取队列中的消息     print(q.get())    mp.join()

## 使用进程池管理进程

程序可以通过multiprocessing模块的Pool()函数来创建进程池,它实际上是multiprocess.pool.Pool类,它提供了如下常用函数:

-apply(func[, args[, kwds]]):将func函数提交给进程池处理,其中args代表传给func的位置参数,kwds代表传给func的关键字参数,该方法会被阻塞直到func函数执行完成

-apply_async(func[, args[, kwds[, callback[, error_callback]]]]):这是apply()函数的异步版,该方法不会被阻塞,其中callback指定func函数完成后的回调函数,error_callback指定func函数出错后的回调函数

-map(func, iterable[, chunksize]):类似于Python的map()函数,只是此处使用新进程对iterable的每一个元素执行func函数

-map_async(func, iterable[, chunksize[, callback[, error_callback]]]):这是map()方法的异步版,该方法不会被阻塞,其中callback指定func函数完成后的回调函数,error_callback指定func函数出错后的回调函数

- imap(func, iterable[, chunksize]):map()方法的延迟版本

-imap_unrodered(func, iterable[, chunksize]):功能类似于imap()方法,但该方法不能保证所有生成的结果(包含多个元素)与原iterable中的元素顺序一致

-starmap(func, iterable[, chunksize]):类似于map()方法,该方法要求iterable的元素也是iterable对象,程序会将每一个元素解包之后作为func函数的参数

-close():关闭进程池,该方法让进程池不能再接收新任务,但会继续执行当前进程池中所有任务,直到完毕再关闭自己

- terminate():立即中止进程池

- join():等待所有进程完成

import multiprocessingimport timeimport osdef action(name='default'):    print('(%s)进程正在执行,参数为: %s' % (os.getpid(), name))    time.sleep(3)if __name__ == '__main__':    # 创建包含4条进程的进程池    pool = multiprocessing.Pool(processes=4)    # 将action分3次提交给进程池    pool.apply_async(action)    pool.apply_async(action, args=('位置参数', ))    pool.apply_async(action, kwds={'name''关键字参数'})    pool.close()    pool.join()
import multiprocessingimport timeimport os# 定义一个准备作为进程任务的函数def action(max):    my_sum = 0    for i in range(max):        print('(%s)进程正在执行: %d' % (os.getpid(), i))        my_sum += i    return my_sumif __name__ == '__main__':    # 创建一个包含4条进程的进程池    with multiprocessing.Pool(processes=4as pool:        # 使用进程执行map计算        # 后面元组有3个元素,因此程序启动3条进程来执行action函数        results = pool.map(action, (50100150))        print('--------------')        for r in results:            print(r)

## 进程通信

Python为进程通信提供了两种机制

-Queue:一个进程向Queue中放入数据,另一个进程从Queue中读取数据

-Pipe:Pipe代表链接两个进程的管道,程序在调用Pipe()函数时会产生两个链接端,分别交给通信的两个进程,然后进程既可以从该链接端读取数据,也可以向该连接端写入数据

### 使用Queue实现进程通信

multiprocess下的Queue和queue下的Queue类似,都提供了qsize()/empty()/full()/put()/put_nowait()/get()/get_nowait()等方法,区别只是一个服务于进程,一个服务于线程

import multiprocessingdef f(q):    print('(%s) 进程开始放入数据...' % multiprocessing.current_process().pid)    q.put('Python')if __name__ == '__main__':    # 创建进程通信的Queue    q = multiprocessing.Queue()    # 创建子进程    p = multiprocessing.Process(target=f, args=(q,))    # 启动子进程    p.start()    print('(%s) 进程开始取出数据...' % multiprocessing.current_process().pid)    # 取出数据    print(q.get())  # Python    p.join()

### 使用Pipe实现进程通信

程序调用multiprocessing.Pipe()函数来创建一个管道,并返回两个PipeConnection对象,用于连接通信的两个进程,PipeConnection有如下方法:

-send(obj):发送一个obj给管道的另一端,另一端使用recv()方法接收,该obj必须是可拿到的,并且如果该对象系列化后超过32MB则可能会报ValueError异常

-recv():接受另一端通过send()方法发送过来的数据

-fileno():关于连接所使用的文件扫描器

-close():关闭连接

-poll(timeout):返回链接中是否还有数据可以读取

- send_bytes(buffer[, offset[, size]]):发送字节数据,如果没有指定offset、size参数,则默认发送buffer字节串的全部数据;如果指定了offset和size参数,则只发送buffer字节串中从offset开始,长度为size的字节数据,通过该方法发送的数据应该使用recv_bytes()或者recv_bytes_into()方法接收

-recv_bytes([maxlength]):接收通过send_bytes()方法发送的数据,maxlength指定最多接收的字节数,该方法返回接收到的字节数据

-recv_bytes_into(buffer[, offset]):功能与recv_bytes()方法类似,只是该方法将接收到的数据放在buffer中

import multiprocessingdef f(conn):    print('(%s) 进程开始发送数据...' % multiprocessing.current_process().pid)    # 使用conn发送数据    conn.send('Python')if __name__ == '__main__':    # 创建Pipe,该函数返回两个PipeConnection对象    parent_conn, child_conn = multiprocessing.Pipe()    # 创建子进程    p = multiprocessing.Process(target=f, args=(child_conn, ))    # 启动子进程    p.start()    print('(%s) 进程开始接收数据...' % multiprocessing.current_process().pid)    # 通过conn读取数据    print(parent_conn.recv())  # Python    p.join()

## 多线程与多进程

import multiprocessingimport timeclass Account:    # 定义构造器    def __init__(self, account_no, balance, lock):        # 封装账户编号、账户余额的两个成员变量        self.account_no = account_no        self._balance = balance        self.lock = lock    # 因为账户余额不允许随便修改,所以只为self._balance提供getter方法    def getBalance(self):        return self._balance    # 提供一个进程安全的draw()方法来完成取钱操作    def draw(self, draw_amount):        # 加锁        self.lock.acquire()        try:            # 账户余额大于取钱数目            if self._balance >= draw_amount:                # 吐出钞票                print(multiprocessing.current_process().name\                    + "取钱成功!吐出钞票:" + str(draw_amount))                time.sleep(0.001)                # 修改余额                self._balance -= draw_amount                print("\t余额为: " + str(self._balance))            else:                print(multiprocessing.current_process().name\                    + "取钱失败!余额不足!")        finally:            # 修改完成,释放锁            self.lock.release()# 定义一个函数来模拟取钱操作def draw(account, draw_amount):    print(account)    # 直接调用account对象的draw()方法来执行取钱操作    account.draw(draw_amount)if __name__ == '__main__':    lock = multiprocessing.RLock()    # 创建一个账户    acct = Account("1234567" , 900, lock)    # 模拟两个进程对同一个账户取钱    multiprocessing.Process(name='甲', target=draw , args=(acct , 800)).start()    multiprocessing.Process(name='乙', target=draw , args=(acct , 800)).start()    multiprocessing.Process(name='丙', target=draw , args=(acct , 800)).start()

## 更多实例

多进程multiprocessing模块和多线程threading模块的使用方式很类似,在CPU密集型的程序中多线程并不能达到高效运转的效果,为了发挥多核CPU的优势使用多进程更有效果

### 多进程调用接口

# -*- coding: utf-8 -*-import multiprocessingimport requestsfrom time import ctimeimport jsondef syc_email(userID, userName):    """syc_email"""    print("Start synchronizing %s %s" % ("email", ctime()))    parameter = {"userId":userID,"userName":userName,"enterpriseId":"10330","flag":"sended"}    request_own = requests.put("https://xxxxxx.leadscloud.com/mail/receiveSendedAndRubbishMail", data=parameter)    data = request_own.json()    print(json.dumps(data, indent=4, sort_keys=True, ensure_ascii=False) )    print("接口调用已经返回结果,本次同步结束")dicts = {'1263':'13810078954','1294':'13810327625','1223':'18515934978','1295':'13911154792'}threads = []files = range(len(dicts))for userID, userName in dicts.items():    mp = multiprocessing.Process(target = syc_email, args = (userID, userName))    threads.append(mp)if __name__ == '__main__':    for p in files:        threads[p].start()    for p in files:        threads[p].join()    print('all end: %s' % ctime())

### 执行结果

PS C:\Users\Administrator\Desktop> python .\multipreocess.pyStart synchronizing email Thu Mar 21 13:54:26 2019Start synchronizing email Thu Mar 21 13:54:26 2019Start synchronizing email Thu Mar 21 13:54:26 2019Start synchronizing email Thu Mar 21 13:54:26 2019{    "code": 1,    "data"0,    "msg""成功"}接口调用已经返回结果,本次同步结束{    "code": 1,    "data"0,    "msg""成功"}接口调用已经返回结果,本次同步结束{    "code": 1,    "data"0,    "msg""成功"}接口调用已经返回结果,本次同步结束{    "code": 1,    "data"0,    "msg""成功"}接口调用已经返回结果,本次同步结束all end: Thu Mar 21 14:03:22 2019

请在微信客户端打开

### 多进程启动浏览器

# -*- coding: utf-8 -*-from selenium import webdriverfrom time import sleepfrom time import ctimeimport multiprocessingdef start_browser(browser, time):    if browser == "chrome":        print("starting chrome browser now! %s" % ctime())  # 控制台打印当前时间         chrome_driver = webdriver.Chrome()        chrome_driver.get("http://www.baidu.com")        sleep(time)        chrome_driver.quit()    elif browser == "firefox":        print("starting firefox browser now! %s" % ctime())  # 控制台打印当前时间        fire_driver = webdriver.Firefox()        fire_driver.get("http://www.baidu.com")        sleep(time)        fire_driver.quit()    else        print("starting ie browser now! %s" %ctime())  # 控制台打印当前时间        ie_driver = webdriver.Ie()        ie_driver.get("http://www.baidu.com")        sleep(time)        ie_driver.quit()#  定义字典参数        browser_dict = {"chrome"3"firefox"4}#  定义空List用于存储进程start_browser_processing = []#  循环字典Key-Value,创建进程并加入到List中for browser, time in browser_dict.items():    processing_browser = multiprocessing.Process(target=start_browser, args=(browser, time))    start_browser_processing.append(processing_browser)if __name__ == '__main__':    for processing_browser in range(len(browser_dict)):        start_browser_processing[processing_browser].start()    for processing_browser in range(len(browser_dict)):        start_browser_processing[processing_browser].join()    print(u"全部结束 %s" % ctime())

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-08 16:51:01 HTTP/2.0 GET : https://f.mffb.com.cn/a/462899.html
  2. 运行时间 : 0.309348s [ 吞吐率:3.23req/s ] 内存消耗:4,537.34kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=fb83041df5ad8a01d1262cc979ba824e
  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.000967s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001480s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.013108s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.011175s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001667s ]
  6. SELECT * FROM `set` [ RunTime:0.000826s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001360s ]
  8. SELECT * FROM `article` WHERE `id` = 462899 LIMIT 1 [ RunTime:0.021673s ]
  9. UPDATE `article` SET `lasttime` = 1770540661 WHERE `id` = 462899 [ RunTime:0.009467s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.001806s ]
  11. SELECT * FROM `article` WHERE `id` < 462899 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.013113s ]
  12. SELECT * FROM `article` WHERE `id` > 462899 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.012156s ]
  13. SELECT * FROM `article` WHERE `id` < 462899 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.018292s ]
  14. SELECT * FROM `article` WHERE `id` < 462899 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.015925s ]
  15. SELECT * FROM `article` WHERE `id` < 462899 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.040989s ]
0.311629s