當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Request::secure方法代碼示例

本文整理匯總了PHP中Illuminate\Http\Request::secure方法的典型用法代碼示例。如果您正苦於以下問題:PHP Request::secure方法的具體用法?PHP Request::secure怎麽用?PHP Request::secure使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Http\Request的用法示例。


在下文中一共展示了Request::secure方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: buildCsp

 /**
  * Add content security policy headers to response.
  *
  * @return void
  *
  * @throws \Exception
  */
 protected function buildCsp()
 {
     if ($this->response instanceof BinaryFileResponse) {
         return;
     }
     $csp = CSPBuilder::fromFile(config_path('csp.json'));
     $csp->addDirective('upgrade-insecure-requests', $this->request->secure());
     $this->response->withHeaders($csp->getHeaderArray(false));
 }
開發者ID:BePsvPT,項目名稱:CCUSA,代碼行數:16,代碼來源:PreprocessMiddleware.php

示例2: matches

 /**
  * Validate a given rule against a route and request.
  *
  * @param  \Illuminate\Routing\Route  $route
  * @param  \Illuminate\Http\Request  $request
  * @return bool
  */
 public function matches(Route $route, Request $request)
 {
     if ($route->httpOnly()) {
         return !$request->secure();
     } elseif ($route->secure()) {
         return $request->secure();
     }
     return true;
 }
開發者ID:aysenli,項目名稱:laravel-admin-1,代碼行數:16,代碼來源:SchemeValidator.php

示例3: handle

 /**
  * Redirects any non-secure requests to their secure counterparts.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return redirects to the secure counterpart of the requested uri.
  */
 public function handle($request, Closure $next)
 {
     if (!$request->secure() && app()->environment('production')) {
         return redirect()->secure($request->getRequestUri());
     }
     return $next($request);
 }
開發者ID:Oprax,項目名稱:calendar-site,代碼行數:14,代碼來源:HTTPSMiddleware.php

示例4: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$request->secure() && env('APP_ENV') === 'prod') {
         return redirect()->secure($request->getRequestUri());
     }
     return $next($request);
 }
開發者ID:Denniskevin,項目名稱:Laravel5Starter,代碼行數:14,代碼來源:ForceHttps.php

示例5: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$request->secure()) {
         abort(404);
     }
     return $next($request);
 }
開發者ID:hugoram,項目名稱:codesvalidator,代碼行數:14,代碼來源:SSLOnly.php

示例6: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$request->secure() && !str_contains($request->getRequestUri(), '/podcasts/rss')) {
         return redirect()->secure($request->getRequestUri(), 301);
     }
     return $next($request);
 }
開發者ID:WellCoded,項目名稱:website,代碼行數:14,代碼來源:Secure.php

示例7: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$request->secure()) {
         return redirect()->secure($request->getRequestUri());
     }
     return $next($request);
 }
開發者ID:mnt,項目名稱:download-neptunium,代碼行數:14,代碼來源:HttpsProtocol.php

示例8: root

 /**
  * Get route root.
  *
  * @return string
  */
 public function root()
 {
     $http = $this->request->secure() ? 'https' : 'http';
     $domain = trim($this->domain(true), '/');
     $prefix = $this->prefix(true);
     return trim("{$http}://{$domain}/{$prefix}", '/');
 }
開發者ID:jitheshgopan,項目名稱:extension,代碼行數:12,代碼來源:RouteGenerator.php

示例9: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$request->secure()) {
         return Redirect::secure($request->path());
     }
     return $next($request);
 }
開發者ID:alexandrzavalii,項目名稱:larabid,代碼行數:14,代碼來源:ssl.php

示例10: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param Closure                  $next
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function handle($request, Closure $next)
 {
     if (env('APP_HTTPS') && !env('APP_DEBUG') && !$request->secure()) {
         return redirect()->secure($request->getRequestUri());
     }
     return $next($request);
 }
開發者ID:Hiroto-K,項目名稱:HkApps,代碼行數:15,代碼來源:HttpsProtocol.php

示例11: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($request->secure()) {
         //return redirect("https://{$_SERVER['HTTP_HOST']}" . $request->getRequestUri());
         return redirect()->secure($request->getRequestUri());
     }
     return $next($request);
 }
開發者ID:vidmahovic,項目名稱:ep-store,代碼行數:15,代碼來源:HttpsRouting.php

示例12: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $request->setTrustedProxies([$request->getClientIp()]);
     if (!$request->secure()) {
         return redirect()->secure($request->getRequestUri());
     }
     return $next($request);
 }
開發者ID:2n2n,項目名稱:food4lunch,代碼行數:15,代碼來源:HttpsMiddleware.php

示例13: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$request->secure() && env('APP_ENV') === 'production') {
         $request->setTrustedProxies([$request->getClientIp()]);
         return redirect()->secure($request->getRequestUri());
     }
     return $next($request);
 }
開發者ID:johannesponader,項目名稱:Onepager,代碼行數:15,代碼來源:HttpsProtocol.php

示例14: forceSSL

 /**
  * Force to use https:// requests
  *
  * @return null|RedirectResponse Redirects to the https:// protocol if the current request is insecure
  */
 public function forceSSL()
 {
     if (!$this->request->secure()) {
         return $this->redirect->secure($this->request->getRequestUri());
     }
     return null;
     // The request is already secure
 }
開發者ID:LaraGit,項目名稱:larapress,代碼行數:13,代碼來源:Helpers.php

示例15: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // if not local environment AND the request isn't safe
     if (!app()->isLocal() && !$request->secure()) {
         // redirect to the mathching secure url
         return redirect()->secure($request->path());
     }
     return $next($request);
 }
開發者ID:WhatDaFox-Examples,項目名稱:ProjectFactory,代碼行數:16,代碼來源:RedirectIfInsecure.php


注:本文中的Illuminate\Http\Request::secure方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。