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


PHP Response::getContent方法代码示例

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


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

示例1: __construct

 /**
  * @param \TYPO3\Flow\Http\Response $response
  * @param \TYPO3\Flow\Http\Request $request
  *
  * @throws \Flowpack\ElasticSearch\Transfer\Exception
  * @throws \Flowpack\ElasticSearch\Transfer\Exception\ApiException
  */
 public function __construct(\TYPO3\Flow\Http\Response $response, \TYPO3\Flow\Http\Request $request = null)
 {
     $this->originalResponse = $response;
     $treatedContent = json_decode($response->getContent(), true);
     if (strlen($response->getContent()) > 0) {
         if ($treatedContent === null) {
             throw new Exception('The request returned an invalid JSON string which was "' . $response->getContent() . '".', 1338976439, $response, $request);
         }
         if (array_key_exists('error', $treatedContent)) {
             throw new Exception\ApiException($treatedContent['error'], 1338977435, $response, $request);
         }
     }
     $this->treatedContent = $treatedContent;
 }
开发者ID:robertlemke,项目名称:Flowpack.ElasticSearch,代码行数:21,代码来源:Response.php

示例2: logApiCall

 /**
  * @param string $url 
  * @param string $method 
  * @param Response $response 
  * @return void
  */
 public function logApiCall($url, $method, Response $response)
 {
     if ($this->settings['gitApi']['requestListener']['log'] === TRUE) {
         $directory = $this->getLogDirectory();
         file_put_contents($directory . '/SurfCaptain_Request.log', $method . '_' . $url . "\n", FILE_APPEND);
         file_put_contents($directory . '/SurfCaptain_Request.log', $response->getContent() . "\n", FILE_APPEND);
     }
 }
开发者ID:lightwerk,项目名称:surfcaptain,代码行数:14,代码来源:RequestListener.php

示例3: __construct

 /**
  *
  */
 public function __construct($message, $code, \TYPO3\Flow\Http\Response $response, \TYPO3\Flow\Http\Request $request = NULL, \Exception $previous = NULL)
 {
     $this->response = $response;
     $this->request = $request;
     if ($request !== NULL) {
         $message = sprintf("[%s %s]: %s\n\nRequest data: %s", $request->getMethod(), $request->getUri(), $message . '; Response body: ' . $response->getContent(), $request->getContent());
     }
     parent::__construct($message, $code, $previous);
 }
开发者ID:johannessteu,项目名称:Flowpack.ElasticSearch,代码行数:12,代码来源:Exception.php

示例4: render

 /**
  * Render this form.
  *
  * @return string rendered form
  * @api
  * @throws \TYPO3\Form\Exception\RenderingException
  */
 public function render()
 {
     if ($this->isAfterLastPage()) {
         $this->invokeFinishers();
         return $this->response->getContent();
     }
     $this->formState->setLastDisplayedPageIndex($this->currentPage->getIndex());
     if ($this->formDefinition->getRendererClassName() === NULL) {
         throw new \TYPO3\Form\Exception\RenderingException(sprintf('The form definition "%s" does not have a rendererClassName set.', $this->formDefinition->getIdentifier()), 1326095912);
     }
     $rendererClassName = $this->formDefinition->getRendererClassName();
     $renderer = new $rendererClassName();
     if (!$renderer instanceof \TYPO3\Form\Core\Renderer\RendererInterface) {
         throw new \TYPO3\Form\Exception\RenderingException(sprintf('The renderer "%s" des not implement RendererInterface', $rendererClassName), 1326096024);
     }
     $controllerContext = $this->getControllerContext();
     $renderer->setControllerContext($controllerContext);
     $renderer->setFormRuntime($this);
     return $renderer->renderRenderable($this);
 }
开发者ID:sinso,项目名称:TYPO3.Flow,代码行数:27,代码来源:FormRuntime.php

示例5: contentCanBeSetAppendedAndRetrieved

 /**
  * @test
  */
 public function contentCanBeSetAppendedAndRetrieved()
 {
     $response = new Response();
     $response->setContent('Two households, both alike in dignity, ');
     $response->appendContent('In fair Verona, where we lay our scene');
     $this->assertEquals('Two households, both alike in dignity, In fair Verona, where we lay our scene', $response->getContent());
     $response->setContent('For never was a story of more woe, Than this of Juliet and her Romeo.');
     $this->assertEquals('For never was a story of more woe, Than this of Juliet and her Romeo.', $response->getContent());
     $this->assertEquals('For never was a story of more woe, Than this of Juliet and her Romeo.', (string) $response);
 }
开发者ID:cerlestes,项目名称:flow-development-collection,代码行数:13,代码来源:ResponseTest.php

示例6: getCrawler

 /**
  * Returns the DOM crawler which can be used to interact with the web page
  * structure, submit forms, click links or fetch specific parts of the
  * website's contents.
  *
  * The returned DOM crawler is bound to the response of the last executed
  * request.
  *
  * @return \Symfony\Component\DomCrawler\Crawler
  * @api
  */
 public function getCrawler()
 {
     $crawler = new Crawler(null, $this->lastRequest->getBaseUri());
     $crawler->addContent($this->lastResponse->getContent(), $this->lastResponse->getHeader('Content-Type'));
     return $crawler;
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:17,代码来源:Browser.php

示例7: equals

 public function equals($string)
 {
     $this->test->assertSame($string, $this->response->getContent(), 'The Response did not equal the string <' . $string . '>');
     return $this;
 }
开发者ID:econic,项目名称:testing,代码行数:5,代码来源:ResponseProxy.php

示例8: render

 /**
  * @param string $path
  * @return string
  * @throws \Exception
  */
 public function render($path = NULL)
 {
     if ($path === NULL) {
         $path = '404';
     }
     /** @var RequestHandler $activeRequestHandler */
     $activeRequestHandler = $this->bootstrap->getActiveRequestHandler();
     $parentHttpRequest = $activeRequestHandler->getHttpRequest();
     $requestPath = $parentHttpRequest->getUri()->getPath();
     $language = explode('/', ltrim($requestPath, '/'))[0];
     if ($language === 'neos') {
         throw new \Exception('NotFoundViewHelper can not be used for neos-routes.', 1435648210);
     }
     $language = $this->localeDetector->detectLocaleFromLocaleTag($language)->getLanguage();
     if ($this->contentDimensionPresetSource->findPresetByUriSegment('language', $language) === NULL) {
         $language = '';
     }
     if ($language !== '') {
         $language .= '/';
     }
     $request = Request::create(new Uri(rtrim($parentHttpRequest->getBaseUri(), '/') . '/' . $language . $path));
     $matchingRoute = $this->router->route($request);
     if (!$matchingRoute) {
         throw new \Exception(sprintf('Uri with path "%s" could not be found.', rtrim($parentHttpRequest->getBaseUri(), '/') . '/' . $language . $path), 1426446160);
     }
     $response = new Response();
     $objectManager = $this->bootstrap->getObjectManager();
     $baseComponentChain = $objectManager->get('TYPO3\\Flow\\Http\\Component\\ComponentChain');
     $componentContext = new ComponentContext($request, $response);
     $baseComponentChain->handle($componentContext);
     return $response->getContent();
 }
开发者ID:neos-helpers,项目名称:Helper.NotFound,代码行数:37,代码来源:NotFoundViewHelper.php


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