GuzzleHttp 中使用 timeout 参数设置请求超时时间,避免在接口异常时大量占用 php 进程, timeout 参数的单位是秒。

use GuzzleHttp\Client;
        
$url = "https://www.02405.com";
$client = new Client();
try {
	$response = $client->post($url,['timeout'  => 20]);
	$data = json_decode($response->getBody()->getContents(),true);
	return $data;
} catch (Exception $e) {
	Log::error($e);
	return rnull;
}

(adsbygoogle = window.adsbygoogle || []).push({});