當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。