作者 lyh

gx

@@ -100,6 +100,7 @@ if (!function_exists('http_get')) { @@ -100,6 +100,7 @@ if (!function_exists('http_get')) {
100 curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true); 100 curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
101 curl_setopt($ch1, CURLOPT_ENCODING, ''); 101 curl_setopt($ch1, CURLOPT_ENCODING, '');
102 curl_setopt($ch1, CURLOPT_MAXREDIRS, 10); 102 curl_setopt($ch1, CURLOPT_MAXREDIRS, 10);
  103 + curl_setopt($ch1, CURLOPT_TIMEOUT, 120);
103 curl_setopt($ch1, CURLOPT_HTTPHEADER, $header); 104 curl_setopt($ch1, CURLOPT_HTTPHEADER, $header);
104 curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, $timeout); 105 curl_setopt($ch1, CURLOPT_CONNECTTIMEOUT, $timeout);
105 curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, true); 106 curl_setopt($ch1, CURLOPT_FOLLOWLOCATION, true);
@@ -313,7 +313,7 @@ class NewsController extends BaseController @@ -313,7 +313,7 @@ class NewsController extends BaseController
313 ],[ 313 ],[
314 'keyword.required' => 'keyword不能为空', 314 'keyword.required' => 'keyword不能为空',
315 ]); 315 ]);
316 - $data = http_get('http://gnews.globalso.com/gnews_news.php?keyword='.$this->param['keyword']); 316 + $data = http_get('http://gnews.globalso.com/gnews_news.php?keyword='.$this->param['keyword'],['charset=utf-8']);
317 $this->response('success',Code::SUCCESS,$data); 317 $this->response('success',Code::SUCCESS,$data);
318 } 318 }
319 } 319 }