V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
szopen
V2EX  ›  PHP

最近用 PHP 线程写爬虫,感觉 pthreads 还不错,分享一下自己封装的一个简单线程类

  •  
  •   szopen · Dec 15, 2015 · 2967 views
    This topic created in 3794 days ago, the information mentioned may be changed or developed.

    分享就不转原文了,见链接
    ( http://toknot.com/blog/php-thread/)

    主要实现了一个线程池管理类和一个配套的线程类

    特点:

    1. 线程间数据共享全部使用字符串,所以不支持资源的共享,另外需要说明的是 pthreads 扩展不支持持久化连接
    2. 简化了创建线程的方法
    3. 仅供参考

    最后, pthreads 作者很不错,问题反馈很及时,所以这个扩展的支持还是有保证的

    5 replies    2016-10-29 12:12:08 +08:00
    wujunze
        1
    wujunze  
       Dec 17, 2015
    flyshu
        2
    flyshu  
       Dec 28, 2015
    不错,想学习这方面,不过网址打不开,是错误还是被墙了
    szopen
        3
    szopen  
    OP
       Dec 29, 2015
    @flyshu 网站是在 github pages ,你能访问 github 就应该能访问
    techmoe
        4
    techmoe  
       Jan 27, 2016 via Android
    不错,先码
    vicki
        5
    vicki  
       Oct 29, 2016
    Page Not Found OR Not Build
    ???
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2825 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 52ms · UTC 09:02 · PVG 17:02 · LAX 02:02 · JFK 05:02
    ♥ Do have faith in what you're doing.