当前位置: 首页>>代码示例>>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;未经允许,请勿转载。