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


PHP HttpResponse::create方法代码示例

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


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

示例1: getRedirectResponse

 public function getRedirectResponse()
 {
     if (!$this->isRedirect()) {
         throw new RuntimeException('This response does not support redirection.');
     }
     $output = json_encode($this->getData());
     return HttpResponse::create($output);
 }
开发者ID:aunn,项目名称:omnipay-txprocess,代码行数:8,代码来源:Response.php

示例2: createResponse

 /**
  * creates instance to test
  *
  * @param   string  $response  content of response
  * @return  HttpResponse
  */
 private function createResponse(string $response) : HttpResponse
 {
     $file = vfsStream::newFile('response')->withContent($response)->at(vfsStream::setup());
     return HttpResponse::create(new Stream(fopen($file->url(), 'rb+')));
 }
开发者ID:stubbles,项目名称:stubbles-peer,代码行数:11,代码来源:HttpResponseTest.php

示例3: exceptionHandler

 /**
  * API PHP Exception handler.
  * This is a generic exception handler for PHP exceptions. This will catch any
  * uncaught exception, end API execution and return the result to the requestor
  * as an ErrorResult in the requested format.
  *
  * @param Exception $exception Exception
  *
  * @return void
  * @access private
  */
 public function exceptionHandler($exception)
 {
     $time = date("Y-m-d H:i:s (T)");
     $msg = $exception->getMessage() ?: elgg_echo('Exception:UnknownType');
     $code = $exception->getCode() ?: 500;
     $error = "{$time}: {$msg} in file {$exception->getFile()} (line {$exception->getLine()})";
     $this->log($error, "EXCEPTION");
     $result = new ErrorResult($msg, $code, $exception);
     if ($this->router) {
         $this->router->send($result);
     } else {
         $output = elgg_view('graph/output', array('result' => $result));
         if (elgg_get_viewtype() === 'default') {
             $layout = elgg_view_layout('one_column', array('content' => $output));
             $output = elgg_view_page('', $layout);
         }
         HttpResponse::create($output, $result->getStatusCode())->send();
     }
 }
开发者ID:hypejunction,项目名称:hypegraph,代码行数:30,代码来源:Logger.php

示例4: delete

 /**
  * initializes a put request
  *
  * @param   int                                     $timeout  optional  connection timeout, defaults to 30 seconds
  * @param   string|\stubbles\peer\http\HttpVersion  $version  optional  http version, defaults to HTTP/1.1
  * @return  \stubbles\peer\http\HttpResponse
  * @since   2.0.0
  */
 public function delete(int $timeout = 30, $version = HttpVersion::HTTP_1_1) : HttpResponse
 {
     $socket = $this->httpUri->openSocket($timeout);
     $this->processHeader($socket, Http::DELETE, $version);
     return HttpResponse::create($socket);
 }
开发者ID:stubbles,项目名称:stubbles-peer,代码行数:14,代码来源:HttpRequest.php


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