12345678910111213141516171819202122232425262728293031323334353637 |
- <?php
- namespace Qii\Library;
- /**
- * A parallel HTTP client written in pure PHP
- *
- * This file just for non-composer user, require this file directly.
- *
- * @author hightman <hightman@twomice.net>
- * @link http://hightman.cn
- * @copyright Copyright (c) 2015 Twomice Studio.
- */
- \Qii\Autoloader\Psr4::getInstance()
- ->setUseNamespaces([
- ['Curl', true],
- ])
- ->addNamespaces([
- ['Curl', Qii_DIR . DS .'Library'. DS . 'Third'. DS .'Curl'],
- ]);
- use Curl\Curl;
- class LibUrl extends Curl
- {
- /**
- * 设置超时时间, 解决毫秒问题
- *
- * @param $seconds
- */
- public function setTimeout($seconds)
- {
- if($seconds < 1)
- {
- $this->setOpt(CURLOPT_TIMEOUT_MS, intval($seconds * 1000));
- $this->setOpt(CURLOPT_NOSIGNAL, 1);
- }
- $this->setOpt(CURLOPT_TIMEOUT, $seconds);
- }
- }
|