Commit 465272aa by HanSon

get请求设置超时

1 parent 8ecc3db8
......@@ -32,11 +32,15 @@ class Http
return static::$instance;
}
public function get($url, array $query = [])
public function get($url, array $query = [], array $options = [])
{
$query = $query ? ['query' => $query] : [];
if($query){
$options['query'] = $query;
}
$options['connect_timeout'] = 60;
return $this->request($url, 'GET', $query);
return $this->request($url, 'GET', $options);
}
public function post($url, $query = [], $array = false)
......
......@@ -32,7 +32,7 @@ class Sync
]);
try{
$content = http()->get($url, [], ['connect_timeout' => 60]);
$content = http()->get($url);
preg_match('/window.synccheck=\{retcode:"(\d+)",selector:"(\d+)"\}/', $content, $matches);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!