|
@@ -0,0 +1,39 @@
|
|
|
+<?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;
|
|
|
+use Curl\MultiCurl;
|
|
|
+
|
|
|
+class LibMultiCurl extends MultiCurl
|
|
|
+{
|
|
|
+ /**
|
|
|
+ * 设置超时时间, 解决毫秒问题
|
|
|
+ *
|
|
|
+ * @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);
|
|
|
+ }
|
|
|
+}
|