/** * * @param unknown $curlmulti * @param unknown $url * @param unknown $dir */ function __construct($url, $dir) { parent::__construct(); $this->url = $url; $this->dir = $dir; if (!$this->isUrl($url)) { throw new Exception('url is invalid, url=' . $url); } if (!is_dir($this->dir)) { throw new Exception('dir not found, dir=' . $this->dir); } }
function __construct($curl) { parent::__construct($curl); $cacheDir = __DIR__ . '/cache'; $this->imgDir = __DIR__ . '/image'; if (!is_dir($cacheDir)) { mkdir($cacheDir); } if (!is_dir($this->imgDir)) { mkdir($this->imgDir); } $this->getCurl()->cache['dir'] = $cacheDir; $this->getCurl()->cache['enalbe'] = true; $this->getCurl()->maxThread = 12; $this->getCurl()->opt[CURLOPT_CONNECTTIMEOUT] = 10; $this->getCurl()->cbInfo = array($this, 'cbCurlInfo'); $this->getCurl()->maxThreadType['img'] = 10; }