本文整理汇总了PHP中Zend\Http\Response::getContent方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::getContent方法的具体用法?PHP Response::getContent怎么用?PHP Response::getContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Http\Response
的用法示例。
在下文中一共展示了Response::getContent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assertResponseNotInjected
protected function assertResponseNotInjected()
{
$content = $this->response->getContent();
$headers = $this->response->getHeaders();
$this->assertEmpty($content);
$this->assertFalse($headers->has('content-type'));
}
示例2: generate
/**
* Returns an ETag for the given response.
*
* @param HttpRequest $request
* @param HttpResponse $response
* @return string Etag
*/
public function generate(HttpRequest $request, HttpResponse $response)
{
return md5($response->getContent());
}
示例3: decodeResponse
/**
* Decodes response
*
* Response is has JSON structure:
* {"messages":[
* {"to":"null",
* "status":{
* "groupId":5,
* "groupName":"REJECTED",
* "id":51,
* "name":"MISSING_TO",
* "description":"Missing destination.",
* "action":"Check to parameter."
* }
* }
* ]}
*
* @param Response $response
* @return void
*/
private function decodeResponse($response)
{
$data = json_decode($response->getContent());
if (count($data->messages) > 0) {
foreach ($data->messages as $message) {
$this->parseResponseMessage($message);
}
}
}
示例4: toHttpFoundationResponse
/**
* Transforms a Zend\Http\Response into an HttpFoundation one.
*
* @param ZendResponse $zresponse The Zend\Http\Response
*
* @return HttpFoundationResponse
*/
public static function toHttpFoundationResponse(ZendResponse $zresponse)
{
return HttpFoundationResponse::create($zresponse->getContent(), $zresponse->getStatusCode(), $zresponse->getHeaders()->toArray());
}
示例5: sendResponse
private function sendResponse(Response $response)
{
foreach ($response->getHeaders() as $header) {
if ($header instanceof MultipleHeaderInterface) {
header($header->toString(), false);
continue;
}
header($header->toString());
}
$status = $response->renderStatusLine();
header($status);
echo $response->getContent();
}
示例6: createSymfonyResponse
/**
* Converts a zend response to a symfony response.
*
* @param \Zend\Http\Response $response
* @return \Symfony\Component\HttpFoundation\Response
*/
protected static function createSymfonyResponse(ZendResponse $response)
{
$content = $response->getContent();
$status = $response->getStatusCode();
$zendHeaders = $response->getHeaders();
$headers = array();
foreach ($zendHeaders as $header) {
$name = $header->getFieldName();
$headers[$name] = $header->getFieldValue();
}
return new SymfonyResponse($content, $status, $headers);
}