异步提示 Call to undefined function GuzzleHttp\Promise\settle()
使用webman最新版加载了这个包,使用文档例子进行异步操作。出现错误,提示调用了没有定义的function。
$promise = Http::getAsync($url, function (Response $response) { echo '异步请求成功,响应内容:' . $response->body() . PHP_EOL; }, function (RequestException $e) { echo '异步请求异常,错误信息:' . $e->getMessage() . PHP_EOL; }); $promise->wait(); echo json_encode(['code' => 200, 'msg' => '请求成功'], JSON_UNESCAPED_UNICODE) . PHP_EOL;
GUZZLE版本 `guzzlehttp/guzzle 7.8.0 Guzzle is a PHP HTTP client library
guzzlehttp/promises 2.0.1 Guzzle promises library
guzzlehttp/psr7 2.6.1 PSR-7 message implementation that also provides common utility methods ` 下面是报错信息 Error: Call to undefined function GuzzleHttp\Promise\settle() in D:\Web\rsapi\vendor\yzh52521\easyhttp\src\Request.php:100 Stack trace: #0 D:\Web\rsapi\vendor\guzzlehttp\promises\src\TaskQueue.php(50): yzh52521\EasyHttp\Request->__destruct() #1 D:\Web\rsapi\vendor\guzzlehttp\guzzle\src\Handler\CurlMultiHandler.php(163): GuzzleHttp\Promise\TaskQueue->run() #2 D:\Web\rsapi\vendor\guzzlehttp\guzzle\src\Handler\CurlMultiHandler.php(189): GuzzleHttp\Handler\CurlMultiHandler->tick() #3 D:\Web\rsapi\vendor\guzzlehttp\promises\src\Promise.php(251): GuzzleHttp\Handler\CurlMultiHandler->execute(true) #4 D:\Web\rsapi\vendor\guzzlehttp\promises\src\Promise.php(227): GuzzleHttp\Promise\Promise->invokeWaitFn() #5 D:\Web\rsapi\vendor\guzzlehttp\promises\src\Promise.php(272): GuzzleHttp\Promise\Promise->waitIfPending() #6 D:\Web\rsapi\vendor\guzzlehttp\promises\src\Promise.php(229): GuzzleHttp\Promise\Promise->invokeWaitList() #7 D:\Web\rsapi\vendor\guzzlehttp\promises\src\Promise.php(69): GuzzleHttp\Promise\Promise->waitIfPending() #8 D:\Web\rsapi\app\controller\TestController.php(34): GuzzleHttp\Promise\Promise->wait() #9 D:\Web\rsapi\vendor\workerman\webman-framework\src\App.php(325): app\controller\TestController->index(Object(support\Request)) #10 D:\Web\rsapi\vendor\workerman\webman-framework\src\App.php(168): Webman\App::Webman{closure}(Object(support\Request)) #11 D:\Web\rsapi\vendor\workerman\workerman\Connection\TcpConnection.php(646): Webman\App->onMessage(Object(Workerman\Connection\TcpConnection), Object(support\Request)) #12 D:\Web\rsapi\vendor\workerman\workerman\Events\Select.php(311): Workerman\Connection\TcpConnection->baseRead(Resource id #366) #13 D:\Web\rsapi\vendor\workerman\workerman\Worker.php(1485): Workerman\Events\Select->loop() #14 D:\Web\rsapi\vendor\workerman\workerman\Worker.php(1402): Workerman\Worker::forkWorkersForWindows() #15 D:\Web\rsapi\vendor\workerman\workerman\Worker.php(560): Workerman\Worker::forkWorkers() #16 D:\Web\rsapi\vendor\workerman\webman-framework\src\support\App.php(131): Workerman\Worker::runAll() #17 D:\Web\rsapi\start.php(4): support\App::run() #18 {main} [] []
已修复 升级最新版