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


PHP Route::matches方法代码示例

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


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

示例1: setRoute

 /**
  * @param RouteInstance $route
  */
 public function setRoute(RouteInstance $route)
 {
     // Compile route
     $request = new Request();
     $route->matches($request);
     $this->route = $route;
 }
开发者ID:anahkiasen,项目名称:janitor,代码行数:10,代码来源:Route.php

示例2: validateSignedURL

 public function validateSignedURL($actual_url, $signed_url, $substitions)
 {
     $current_route = Request::route();
     $current_route_name = $current_route->getName();
     if (isset($substitions[$current_route_name])) {
         $substition = $substitions[$current_route_name];
         // make sure the host of the signed URL matches the host of the substitution URL
         if (isset($substition['host'])) {
             $signed_host = $this->getHostFromURL($signed_url);
             $allowed_host = $substition['host'];
             if ($signed_host != $allowed_host) {
                 Log::debug("HOST MISMATCH: \$signed_host={$signed_host} \$allowed_host={$allowed_host}");
                 // no host match - return false
                 return false;
             }
         }
         // check the route
         $substitute_route = new Route($current_route->getMethods(), $substition['route'], []);
         $signed_request = \Illuminate\Http\Request::create($signed_url, Request::method());
         if ($substitute_route->matches($signed_request)) {
             // the allowed substitute route matches the signed request
             return true;
         }
         Log::debug("ROUTE MISMATCH: pathinfo=" . json_encode(Request::getFacadeRoot()->getPathInfo()) . " allowed route={$substition['route']}");
     }
     // this signed URL was not valid
     return false;
 }
开发者ID:tokenly,项目名称:laravel-api-provider,代码行数:28,代码来源:AuthenticateProtectedAPIRequest.php

示例3: matches

 /**
  * Determine if the route matches given request.
  *
  * @param \Illuminate\Http\Request $request
  * @param bool                     $includingMethod
  *
  * @return bool
  */
 public function matches(Request $request, $includingMethod = true)
 {
     // If this route uses a WordPress conditional tag
     if ($this->condition()) {
         // Loop trough every validator and if the route passes, return true else false.
         foreach ($this->getWpValidators() as $validator) {
             return $validator->matches($this, $request);
         }
         return false;
     }
     // If no WordPress condition is found, use the normal way of getting a route
     $matches = parent::matches($request, $includingMethod);
     // If we can not find a route using the normal laravel router check if the route which is being checked has the uri "404". If so we return this route as the valid one.
     return !$matches && $this->getUri() === '404' ? true : $matches;
 }
开发者ID:themosis,项目名称:framework,代码行数:23,代码来源:Route.php


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