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


PHP Response::send方法代码示例

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


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

示例1: run

 public function run()
 {
     $request = Request::capture();
     $config = $this->app->get("config");
     $action = $request->input($config->get('app.request_action'), '/');
     $responseContent = $this->runActionController($action);
     if (!$responseContent) {
         return;
     }
     $response = new Response($responseContent);
     $response->send();
     die;
 }
开发者ID:Whyounes,项目名称:WP-KAYO,代码行数:13,代码来源:ControllerHandler.php

示例2: sendResponse

 /**
  * @param Response $response
  * @param string $mimeType
  */
 protected function sendResponse(Response $response, $mimeType)
 {
     if (empty($mimeType)) {
         $mimeType = 'text/html';
     }
     $response->header('Content-type', $mimeType);
     $response->setStatusCode(404);
     $response->send();
     exit;
 }
开发者ID:KodiComponents,项目名称:module-pages,代码行数:14,代码来源:PageNotFoundException.php

示例3: symfonyAction

 public function symfonyAction()
 {
     $ua = Request::header('User-Agent');
     //Redirect to static Masarap page if no User Agent HTTP header was found
     if (!preg_match("@Masarap/@", $ua)) {
         return File::get(public_path() . '/masarap-symfony/index.html');
     }
     // end if no Masarap User Agent
     $status_code = FORCE_UPDATE_STATUS_CODE;
     $data = array('status_code' => $status_code, 'message' => "[{$status_code}] Force Update.", 'app_version' => APP_VERSION, 'app_store' => APP_STORE_LINK, 'google_play' => PLAY_STORE_LINK);
     $response = new Response(json_encode($data));
     $response->setStatusCode($status_code, "Force Update");
     $response->headers->set('Content-Type', 'application/json');
     $response->send();
     exit;
 }
开发者ID:jigen7,项目名称:laravel5,代码行数:16,代码来源:ApiController.php

示例4: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     //check Server Status
     if (SERVER_STATUS === 1) {
         $response = new Response();
         $status_code = SERVER_MAINTENANCE_STATUS_CODE;
         $response->setStatusCode($status_code, "Under Maintenance");
         $response->send();
         exit;
     }
     //end of SERVER STATUS CHECK
     $ua = $request->headers;
     $accept = $request->headers->get('Accept');
     $bypass = $request->query("bypass");
     if (!$bypass && BYPASS_USER_AGENT_CHECK == 0) {
         //Redirect to static Masarap page if no User Agent HTTP header was found
         if (!preg_match("@Masarap/@", $ua)) {
             return File::get(public_path() . '/masarap-symfony/index.html');
         }
         // end if no Masarap User Agent
         //Check the version in the User Agent for FORCE UPDATE
         //Use in Version 1.1 and Up
         if (!preg_match("@Masarap/" . APP_VERSION . "@", $ua) && !preg_match("@version=" . SERVER_VERSION . "@", $accept)) {
             $status_code = FORCE_UPDATE_STATUS_CODE;
             $data = array('status_code' => $status_code, 'message' => "[{$status_code}] Force Update.", 'app_version' => APP_VERSION, 'app_store' => APP_STORE_LINK, 'google_play' => PLAY_STORE_LINK);
             $response = new Response(json_encode($data));
             $response->setStatusCode($status_code, "Force Update");
             $response->headers->set('Content-Type', 'application/json');
             $response->send();
             exit;
         }
         // end of pregmatch
     }
     // end of bypass if
     return $next($request);
 }
开发者ID:jigen7,项目名称:laravel5,代码行数:43,代码来源:FiltersBefore.php

示例5: render

 /**
  *
  * Final output render
  *
  **/
 public function render()
 {
     $response = new Response($this->getCache());
     //send the response and exit the script
     $response->send();
     exit;
 }
开发者ID:onefasteuro,项目名称:flattnr,代码行数:12,代码来源:Flatten.php

示例6: handle

 /**
  * @param Request $request
  * @return \Illuminate\Http\Response
  */
 public function handle(Request $request)
 {
     try {
         $response = $this->router->dispatch($request);
     } catch (NotFoundHttpException $e) {
         // parse request to return an error according to protocol
         $response = new Response('Page not found', 404);
     } catch (MethodNotAllowedHttpException $e) {
         $response = new Response('Page not found', 404);
     }
     $response->sendHeaders();
     $response->send();
     return $response;
 }
开发者ID:bogdananton,项目名称:multi-routing,代码行数:18,代码来源:App.php


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