0
$client = new \GuzzleHttp\Client();
$res = $client->request('GET', 'http://127.0.0.1/slim_project/getall',
        array(
                'headers' => array(
                    'Authorization' => "Bearer fghfghfgh-sdfsdfs-sdfsdf}",
                )
            )
        );

$data = $response->withBody($res->getBody());
return $this->renderer->render($data->getBody(), 'pages/tables.php');

当我运行代码时。我得到了这个错误。

传递给 Slim\Views\PhpRenderer::render() 的参数 1 必须实现接口 Psr\Http\Message\ResponseInterface,给出 GuzzleHttp\Psr7\Stream 的实例,在 /var/www/html/slim_project/index.php 中调用101 和定义

如何将 Guzzle 转换为 psr/http\message。那我怎么用这个。

提前致谢。

4

1 回答 1

0

return $this->renderer->render($response, 'pages/tables.php', json_decode($data->getBody(), true));

于 2017-02-09T05:48:01.600 回答