auto_cache.php 449 B

12345678910111213141516171819
  1. <?php
  2. require_once '_inc.php';
  3. use Ares333\Curl\Toolkit;
  4. $toolkit = new Toolkit();
  5. $toolkit->setCurl();
  6. $curl = $toolkit->getCurl();
  7. $curl->maxThread = 2;
  8. $curl->cache['enable'] = true;
  9. $curl->cache['dir'] = __DIR__ . '/output/cache';
  10. $url = 'http://www.baidu.com';
  11. for ($i = 0; $i < 20; $i ++) {
  12. $curl->add(
  13. array(
  14. 'opt' => array(
  15. CURLOPT_URL => $url . '?wd=' . $i
  16. )
  17. ));
  18. }
  19. $curl->start();