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


PHP Request::getRequestUri方法代码示例

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


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

示例1: 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

示例2: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (preg_match('/.+\\/$/', $request->getRequestUri())) {
         return Redirect::to(rtrim($request->getRequestUri()), 301);
     }
     return $next($request);
 }
开发者ID:saj696,项目名称:pipe,代码行数:14,代码来源:RedirectTrailingSlash.php

示例3: handle

 /**
  * Handle an incoming request.
  *
  * @param \Illuminate\Http\Request $request
  * @param \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$request->isSecure() and env('SECURE_COOKIE', false)) {
         if (strpos($request->getRequestUri(), '/storage/') === false) {
             return redirect()->secure($request->getRequestUri());
         }
     }
     return $next($request);
 }
开发者ID:distilleries,项目名称:expendable,代码行数:16,代码来源:Secure.php

示例4: 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)
 {
     $regex = $route->getCompiled()->getRegex();
     if (str_contains($request->getRequestUri(), '/wp-admin')) {
         return preg_match(str_replace('$#s', '(?:&.+)?$#s', $regex), rawurldecode($request->getRequestUri()));
     }
     $path = $request->path() == '/' ? '/' : '/' . $request->path();
     return preg_match($regex, rawurldecode($path));
 }
开发者ID:lara-press,项目名称:framework,代码行数:17,代码来源:UriValidator.php

示例5: appendDisqusScript

    /**
     * Append disqus script on the end of the page.
     *
     * @param  \Illuminate\Http\Request $request
     * @param  \Illuminate\Http\Response $response
     * @return mixed
     */
    protected function appendDisqusScript($request, $response)
    {
        $content = $response->getContent();
        if (!Str::contains($content, '<div id="disqus_thread"></div>')) {
            return;
        }
        $uri = $request->getRequestUri();
        $pageUrl = url($uri);
        $pageId = 'route' . implode('.', explode('/', $uri));
        $username = config('disqus.username');
        $disqusHtml = <<<CDATA
<script>
     var disqus_config = function () {
         this.page.url = '{$pageUrl}';
         this.page.identifier = '{$pageId}';
     };

    (function() {  // DON'T EDIT BELOW THIS LINE
        var d = document, s = d.createElement('script');

        s.src = '//{$username}.disqus.com/embed.js';

        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    })();
</script>
<noscript>Please enable JavaScript to view the <a href=\\"https://disqus.com/?ref_noscript\\" rel=\\"nofollow\\">comments powered by Disqus.</a></noscript>
CDATA;
        $bodyPosition = strripos($content, '</body>');
        if (false !== $bodyPosition) {
            $content = substr($content, 0, $bodyPosition) . $disqusHtml . substr($content, $bodyPosition);
        }
        $response->setContent($content);
    }
开发者ID:yajra,项目名称:laravel-disqus,代码行数:41,代码来源:DisqusMiddleware.php

示例6: decopaper

 public function decopaper(Request $request)
 {
     $productType = $this->getProductType($request->getRequestUri());
     $model = Category::getType($productType);
     $data = ['data' => $model, 'config' => ['route' => '/decopaper', 'header' => 'Decopapers'], 'title' => 'Decopapers at Dakrush Enterprises'];
     return view('product_display.list', $data);
 }
开发者ID:shegun-babs,项目名称:dakrush,代码行数:7,代码来源:ProductDisplayController.php

示例7: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (extension_loaded('newrelic')) {
         newrelic_name_transaction(sprintf('%s (%s)', $request->getRequestUri(), $request->method()));
     }
     return $next($request);
 }
开发者ID:Nebo15,项目名称:gandalf.api,代码行数:14,代码来源:NewRelicMiddleware.php

示例8: findAllPaginate

 /**
  * @param Request $request
  * @param int $itemsPage
  *
  * @return mixed
  */
 public function findAllPaginate(Request $request, $itemsPage = 30)
 {
     $key = md5($itemsPage . $request->getRequestUri());
     $queryParser = new ParserRequest($request, $this->getModel());
     $queryBuilder = $queryParser->parser();
     return $this->cacheQueryBuilder($key, $queryBuilder, 'paginate', $itemsPage);
 }
开发者ID:e-tipalchuk,项目名称:lumen-shipment-service,代码行数:13,代码来源:CountryRepository.php

示例9: 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

示例10: findAllPaginate

 /**
  * @param Request $request
  * @param int $itemsPage
  * @return mixed
  */
 public function findAllPaginate(Request $request, $itemsPage = 30)
 {
     $key = sprintf('variation_paginate_%s_%s', $itemsPage, $request->getRequestUri());
     $queryParser = ParserRequestFactory::createParser($request, $this->getModel(), $query);
     $queryBuilder = $queryParser->parser();
     return $this->cacheQueryBuilder($key, $queryBuilder, 'paginate', $itemsPage);
 }
开发者ID:rlacerda83,项目名称:catalog-microservice,代码行数:12,代码来源:VariationRepository.php

示例11: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @param  string|null  $guard
  * @return mixed
  */
 public function handle($request, Closure $next, $guard = null)
 {
     //Auth::loginUsingId(47,true);
     //dc($guard);
     //dc(Auth::user());
     if (Auth::guard($guard)->guest()) {
         if ($request->ajax() || $request->wantsJson()) {
             return response('Unauthorized.', 401);
         } else {
             //dd('Authenticate, redirect guest login');
             //return "view";
             return redirect()->guest('login');
         }
     } elseif ($request->is('backStage/*')) {
         if (Auth::user()->isFrontEndUser()) {
             $test = 'Authenticate MIDDLEWARE: unauthorized action: ' . $request->getRequestUri() . ', ' . $request->user()->name . ' must be \'back-end user\'';
             return response()->view("errors.401", compact('test'), 401);
         }
         //dc('backStage/*');
         //dc($request->user()->isBackEndUser());
         //dc(Auth::user()->isBackEndUser());
     }
     //dc('asdf');
     //if (Auth::check())
     //dc(Auth::check());
     //	    dc($guard);
     //dc(Auth::user());
     //dd((Auth::guard($guard)->guest()));
     //	    if (Auth::user()->hasRole('mijnZD-user')){
     //		    return redirect('/dashboard');
     //return redirect()->route('sitemap.indexDashboard');
     //	    }
     //dd($request);
     return $next($request);
 }
开发者ID:wi-development,项目名称:my-framework,代码行数:43,代码来源:Authenticate.php

示例12: 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

示例13: 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

示例14: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (strpos($request->getRequestUri(), 'queue') >= 0) {
         return $next($request);
     }
     return parent::handle($request, $next);
 }
开发者ID:janusnic,项目名称:imgubox,代码行数:14,代码来源:VerifyCsrfToken.php

示例15: 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


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