本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
示例5: render
/**
*
* Final output render
*
**/
public function render()
{
$response = new Response($this->getCache());
//send the response and exit the script
$response->send();
exit;
}
示例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;
}