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


PHP Router::findRoute方法代碼示例

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


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

示例1: findRoute

 /**
  * Find the route matching a given request.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Themosis\Route\Route
  */
 protected function findRoute($request)
 {
     $route = parent::findRoute($request);
     // If the current route is a WordPress route
     if ($route instanceof Route && !$route->condition()) {
         global $wp, $wp_query;
         //Check if the route is not a WordPress route and warn the developer to flush the rewrite rules.
         if ($wp->matched_rule != $route->getRewriteRuleRegex()) {
             /*
              * We cannot rely on the flush_rewrite_rules() function as it's a heavy process
              * especially on a per-request manner.
              * We modify the headers status and set to 200 so it is properly handled.
              * We need to use WordPress headers functions as we only return the response
              * content on each request.
              */
             status_header(200, 'OK');
         }
         // Reset the WordPress query.
         $wp_query->init();
     }
     return $route;
 }
開發者ID:themosis,項目名稱:framework,代碼行數:28,代碼來源:Router.php

示例2: findRoute

 /**
  * Find a route either from the routers collection or the API collection.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Routing\Route
  */
 protected function findRoute($request)
 {
     if ($this->requestTargettingApi($request)) {
         list($this->requestedVersion, $this->requestedFormat) = $this->parseAcceptHeader($request);
         $this->current = $route = $this->getApiRouteCollection($this->requestedVersion)->match($request);
         return $this->substituteBindings($route);
     }
     return parent::findRoute($request);
 }
開發者ID:iwillhappy1314,項目名稱:laravel-admin,代碼行數:15,代碼來源:Router.php

示例3: findRoute

 protected function findRoute($request)
 {
     return parent::findRoute($request);
 }
開發者ID:michaeljhopkins,項目名稱:alexa-app,代碼行數:4,代碼來源:AlexaRouter.php


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