Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/78.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
使用BitBucket API将json数据转换为HTML_Html_Json_Bitbucket_Guzzle_Bitbucket Api - Fatal编程技术网

使用BitBucket API将json数据转换为HTML

使用BitBucket API将json数据转换为HTML,html,json,bitbucket,guzzle,bitbucket-api,Html,Json,Bitbucket,Guzzle,Bitbucket Api,我收到一个请求,要求Bitbucket API在使用Guzzle的Symfony中运行良好。但是,我不确定如何在代码中将其转换为html以显示请求的不同部分 请求如下: $client = new Client(); // The provider provides a way to get an authenticated API request for // the service, using the access

我收到一个请求,要求Bitbucket API在使用Guzzle的Symfony中运行良好。但是,我不确定如何在代码中将其转换为html以显示请求的不同部分

请求如下:

            $client = new Client();

            // The provider provides a way to get an authenticated API request for
            // the service, using the access token; it returns an object conforming
            // to Psr\Http\Message\RequestInterface.
            $request = $provider->getAuthenticatedRequest(
                'GET',
                'https://bitbucket.org/!api/2.0/repositories/xxxx/xxxx/refs/branches',
                $token
            );

            $request2 = $provider->getAuthenticatedRequest(
                'GET',
                'https://bitbucket.org/!api/2.0/repositories/xxxx/xxxx/commits',
                $token
            );

            $promise = $client->sendAsync($request)->then(function ($response) {
                $body = (string) $response->getBody();
                echo $body;
            });
            $promise->wait();

            $promise2 = $client->sendAsync($request2)->then(function ($response) {
                $body = (string) $response->getBody();
                $object = json_decode($body, true);
                var_export($object);
            });
            $promise2->wait();
我把它放在文件的末尾以返回任何数据

    return $this->json([]);
基本上,我的目标是以html格式显示分支、部署和提交等内容,因此我想知道将请求转换为html需要什么(无论是在上面的代码中还是单独)?感谢您的帮助