当前位置: 首页>>代码示例>>PHP>>正文


PHP Response::getContent方法代码示例

本文整理汇总了PHP中Response::getContent方法的典型用法代码示例。如果您正苦于以下问题:PHP Response::getContent方法的具体用法?PHP Response::getContent怎么用?PHP Response::getContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Response的用法示例。


在下文中一共展示了Response::getContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testIfContentIsAppendedCorrectly

 /**
  * @test
  */
 public function testIfContentIsAppendedCorrectly()
 {
     $response = new Response();
     $response->setContent('<html>');
     $this->assertEquals('<html>', $response->getContent());
     $response->appendContent('</html>');
     $this->assertEquals('<html></html>', $response->getContent());
 }
开发者ID:lcobucci,项目名称:action-mapper,代码行数:11,代码来源:ResponseTest.php

示例2: testRebuild

 public function testRebuild()
 {
     $expectedContent = ['foo' => 'bar'];
     $expectedHeaders = new \Phalcon\Http\Response\Headers();
     $expectedHeaders->set('Status', '200 OK');
     $expectedHeaders->set('HTTP/1.1 200 OK', null);
     $this->response->rebuild(['foo' => 'bar']);
     $this->assertEquals($expectedContent, $this->response->getContent());
     $this->assertEquals($expectedHeaders, $this->response->getHeaders());
 }
开发者ID:ovide,项目名称:phest,代码行数:10,代码来源:ResponseTest.php

示例3: handle

 /**
  * @param Response $response
  */
 public function handle(Response $response)
 {
     foreach ($response->getHeaders() as $header) {
         header($header);
     }
     echo $response->getContent();
 }
开发者ID:edefine,项目名称:framework,代码行数:10,代码来源:ResponseHandler.php

示例4: testSetError

 /** @dataProvider provideSetError */
 public function testSetError($expected, $statusCode, $error, $error_description = null, $error_uri = null)
 {
     $response = new Response();
     $response->setError($statusCode, $error, $error_description, $error_uri);
     $this->assertEquals($expected, $response->getContent());
     $this->assertEquals($statusCode, $response->getStatusCode());
 }
开发者ID:Insantani,项目名称:SourceTree-diovi,代码行数:8,代码来源:ResponseTest.php

示例5: createTokenFromResponse

 public function createTokenFromResponse(Response $response)
 {
     $token = json_decode($response->getContent(), true);
     if (isset($token['access_token'])) {
         return new Token($token['access_token'], $token['response_token']);
     }
     return false;
 }
开发者ID:roro15,项目名称:hhapi,代码行数:8,代码来源:Auth.php

示例6: buildMessage

 public function buildMessage(Response $response)
 {
     $str = '';
     $str .= $response->getStatus();
     $str .= "\nURL:\n" . $response->getUrl();
     $str .= "\nPARAMS:\n" . var_export($response->getParams(), true);
     $str .= "\nRESPONSE HEADER:\n" . var_export($response->getHeaders(), true);
     $str .= "\nRESPONSE CONTENT:\n" . substr($response->getContent(), 0, 200);
     return $str;
 }
开发者ID:nikonehauser,项目名称:ptclient,代码行数:10,代码来源:ResponseException.php

示例7: __construct

 /**
  * @param Response $response
  */
 public function __construct(Response $response)
 {
     $content = json_decode($response->getContent(), TRUE);
     if ($content !== NULL && is_array($content)) {
         foreach ($content as $sectionIdentifier => $sectionData) {
             $section = new ResponseSection($sectionIdentifier, $sectionData);
             $this->sections[$sectionIdentifier] = $section;
         }
     }
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:13,代码来源:ResponseContent.php

示例8: createTemplate

    /**
     *
     * @param Response $response
     * @return string
     */
    private function createTemplate($response)
    {
        $content = $response->getContent();
        if ($content instanceof \Exception) {
            $templateContent = $this->createExceptionContent($content);
        } else {
            $templateContent = $this->createObjectContent($content);
        }
        $template = '<!DOCTYPE html>
			<HTML>
				<HEAD>
				</HEAD>
			<BODY>' . $templateContent . '</BODY>
			</HEAD>
			';
        return $template;
    }
开发者ID:itephp,项目名称:framework,代码行数:22,代码来源:HTTPErrorPresenter.php

示例9: process_with_exception

 /**
  * Process this Request when an exception occured
  *
  * @param Request $request
  * @param Response $response
  * @param Exception $exception
  * @return Response
  */
 public static function process_with_exception(Request $request, Response $response, Exception $exception)
 {
     $body = $response->getContent();
     if (ob_get_length()) {
         ob_end_clean();
     }
     $template = ActionView::factory('php');
     $template->assign('error', $exception);
     $template->assign('request', $request);
     $template->assign('response', $response);
     $template->assign('body', $body);
     $text = $template->render_file(MEDICK_PATH . '/libs/action/controller/templates/error.phtml');
     $response->setStatus(HTTPResponse::SC_INTERNAL_SERVER_ERROR);
     $response->setContent($text);
     return $response;
 }
开发者ID:BackupTheBerlios,项目名称:medick-svn,代码行数:24,代码来源:Base.php

示例10: testSetContent

 public function testSetContent()
 {
     $response = new Response('first');
     $response->setContent('second');
     $this->assertEquals('second', $response->getContent());
 }
开发者ID:phprest,项目名称:phprest,代码行数:6,代码来源:ResponseTest.php

示例11: filterResponse

 /**
  * Converts the HttpKernel response to a BrowserKit response.
  *
  * @param Response $response A Response instance
  *
  * @return Response A Response instance
  */
 protected function filterResponse($response)
 {
     return new DomResponse($response->getContent(), $response->getStatusCode(), $response->headers->all());
 }
开发者ID:nickaggarwal,项目名称:sample-symfony2,代码行数:11,代码来源:Client.php

示例12: _sendResponse

 /**
  * Send Response to client
  *
  * @param $response
  * @param String|null $flash
  */
 private function _sendResponse($response, $flash = null)
 {
     try {
         if ($response instanceof Response) {
             switch (strtolower($response->getType())) {
                 case 'html':
                     $view = $this->getMainLayout();
                     $wrapped = Controller::renderit($view, array('content' => $response->getContent()));
                     //, 'flush' => $flash));
                     $response = new Response($wrapped);
                     break;
                 case 'ajax':
                     $response = new Response($response->getContent());
                     break;
             }
             $response->send();
         } else {
             throw new \Exception('Bad response', 500);
         }
     } catch (\Exception $e) {
         new Response($this->renderError($e));
     }
 }
开发者ID:benms,项目名称:eShop,代码行数:29,代码来源:Application.php

示例13: parse

 /**
  * @param Response $response
  * @return array
  */
 public function parse(Response $response)
 {
     return $this->convertXmlToArray($response->getContent());
 }
开发者ID:cdcchen,项目名称:curl-client,代码行数:8,代码来源:XmlParser.php

示例14: parse

 /**
  * @inheritdoc
  */
 public function parse(Response $response)
 {
     return json_decode($response->getContent(), true);
 }
开发者ID:cdcchen,项目名称:curl-client,代码行数:7,代码来源:JsonParser.php

示例15: testWrite

 public function testWrite()
 {
     $this->object->write('1');
     $this->object->write('2');
     $this->assertThat($this->object->getContent(), $this->equalTo('12'));
 }
开发者ID:juraj-blahunka,项目名称:Bachelor-Thesis,代码行数:6,代码来源:ResponseTest.php


注:本文中的Response::getContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。