Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP线程关闭错误:http/client_Php_Multithreading_Class_Closures_Guzzlehttp - Fatal编程技术网

PHP线程关闭错误:http/client

PHP线程关闭错误:http/client,php,multithreading,class,closures,guzzlehttp,Php,Multithreading,Class,Closures,Guzzlehttp,我使用zts php进行线程化工作我有闭包错误guzzle客户端不是序列化$this->client,我使用$client正在工作我如何添加运行函数guzzle HTTP客户端 我得到一个错误: use GuzzleHttp\Client; use GuzzleHttp\Promise\EachPromise; use GuzzleHttp\TransferStats; use Psr\Http\Message\ResponseInterface; use GuzzleHttp\Promise\

我使用zts php进行线程化工作我有闭包错误guzzle客户端不是序列化$this->client,我使用$client正在工作我如何添加运行函数guzzle HTTP客户端

我得到一个错误:

use GuzzleHttp\Client;
use GuzzleHttp\Promise\EachPromise;
use GuzzleHttp\TransferStats;
use Psr\Http\Message\ResponseInterface;
use GuzzleHttp\Promise\PromiseInterface;
class check extends Thread 

{
 function __construct(string $url,int $timeout=60)
    {
        $this->client= new Client([

                'timeout' => $timeout
            ]);
          $this->timeout = $this->timeout;     
    }

    public function run() {

        $response =    $this->client->request('head', "http://www.google.com", [
                'on_stats' => function (TransferStats $stats) {
                    $this->uri = $stats->getEffectiveUri();
                    $this->transferTime = $stats->getTransferTime();
                }
    ]);

  }

}
Fatal error: Uncaught Exception: Serialization of 'Closure' is not allowed in