<?php
namespace app\controller;
use support\Request;
use support\Response;
use Workerman\Protocols\Http\Chunk;
class IndexController
{
public function index(Request $request)
{
$connection = $request->connection;
$http = new \Workerman\Http\Client();
$http->get(xxx, function ($response) use ($connection) {
$connection->send(new Chunk($response->getBody()));
$connection->send(new Chunk('')); // 發(fā)送空的的chunk代表response結(jié)束
});
return response()->withHeaders([
"Transfer-Encoding" => "chunked",
]);
}
}
使用手冊(cè)Demo 出現(xiàn) $connection->send 發(fā)送返回false
請(qǐng)問是什么問題導(dǎo)致的