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


PHP Response::prepare方法代码示例

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


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

示例1: prepareResponse

 /**
  * Create a response instance from the given value.
  *
  * @param  \Symfony\Component\HttpFoundation\Request $request
  * @param  mixed                                     $response
  *
  * @return \Illuminate\Http\Response
  */
 public function prepareResponse($request, $response)
 {
     if ($response instanceof PsrResponseInterface) {
         $response = (new HttpFoundationFactory())->createResponse($response);
     } elseif (!$response instanceof SymfonyResponse) {
         if ($response instanceof View) {
             $response = $this->prepareViewResponse($request, $response);
         }
         $response = new Response($response);
     }
     $response->headers->set('Access-Control-Allow-Credentials', 'true');
     if ($request->isMethod('options')) {
         $headers = ['Access-Control-Allow-Credentials' => 'true', 'Access-Control-Allow-Methods' => 'POST, GET, OPTIONS, PUT, DELETE', 'Access-Control-Allow-Headers' => 'X-Requested-With, Content-Type, X-Auth-Token, Origin, Authorization, X-XSRF-TOKEN, Access-Control-Allow-Credentials'];
         return response('You are connected to the API', 200, $headers);
     }
     return $response->prepare($request);
 }
开发者ID:portonefive,项目名称:essentials,代码行数:25,代码来源:Router.php

示例2: prepareResponse

 /**
  * Create a response instance from the given value.
  *
  * @param  \Symfony\Component\HttpFoundation\Request  $request
  * @param  mixed  $response
  * @return \Illuminate\Http\Response
  */
 public function prepareResponse($request, $response)
 {
     if ($response instanceof PsrResponseInterface) {
         $response = (new HttpFoundationFactory())->createResponse($response);
     } elseif (!$response instanceof SymfonyResponse) {
         $response = new Response($response);
     }
     return $response->prepare($request);
 }
开发者ID:samlev,项目名称:framework,代码行数:16,代码来源:Router.php

示例3: prepareResponse

 /**
  * Prepare the given value as a Response object.
  *
  * @param  mixed  $value
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function prepareResponse($value)
 {
     if (!$value instanceof SymfonyResponse) {
         $value = new Response($value);
     }
     return $value->prepare($this['request']);
 }
开发者ID:jordone,项目名称:diyonline,代码行数:13,代码来源:Application.php

示例4: prepareResponse

 /**
  * Create a response instance from the given value.
  *
  * @param  \Symfony\Component\HttpFoundation\Request  $request
  * @param  mixed  $response
  * @return \Illuminate\Http\Response
  */
 protected function prepareResponse($request, $response)
 {
     if (!$response instanceof SymfonyResponse) {
         $response = new Response($response);
     }
     return $response->prepare($request);
 }
开发者ID:hramose,项目名称:Sistema-Control-de-Almacen,代码行数:14,代码来源:Router.php

示例5: prepare

 /**
  * Prepare the given value as a Response object.
  *
  * @param  mixed  $value
  * @param  \Illuminate\Http\Request  $request
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function prepare($value, Request $request)
 {
     if (!$value instanceof SymfonyResponse) {
         $value = new Response($value);
     }
     return $value->prepare($request);
 }
开发者ID:centaurustech,项目名称:sagip,代码行数:14,代码来源:Router.php


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