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


PHP Route::setHost方法代碼示例

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


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

示例1: setAttributes

 /**
  * Set the attributes and requirements on the route.
  *
  * @param  \Illuminate\Routing\Route  $route
  * @param  array  $action
  * @param  array  $optional
  * @return void
  */
 protected function setAttributes(Route $route, $action, $optional)
 {
     // First we will set the requirement for the HTTP schemes. Some routes may
     // only respond to requests using the HTTPS scheme, while others might
     // respond to all, regardless of the scheme, so we'll set that here.
     if (in_array('https', $action)) {
         $route->setRequirement('_scheme', 'https');
     }
     if (in_array('http', $action)) {
         $route->setRequirement('_scheme', 'http');
     }
     // Once the scheme requirements have been made, we will set the before and
     // after middleware options, which will be used to run any middlewares
     // by the consuming library, making halting the request cycles easy.
     if (isset($action['before'])) {
         $route->setBeforeFilters($action['before']);
     }
     if (isset($action['after'])) {
         $route->setAfterFilters($action['after']);
     }
     // If there is a "uses" key on the route it means it is using a controller
     // instead of a Closures route. So, we'll need to set that as an option
     // on the route so we can easily do reverse routing ot the route URI.
     if (isset($action['uses'])) {
         $route->setOption('_uses', $action['uses']);
     }
     if (isset($action['domain'])) {
         $route->setHost($action['domain']);
     }
     // Finally we will go through and set all of the default variables to null
     // so the developer doesn't have to manually specify one each time they
     // are declared on a route. This is simply for developer convenience.
     foreach ($optional as $key) {
         $route->setDefault($key, null);
     }
 }
開發者ID:centaurustech,項目名稱:sagip,代碼行數:44,代碼來源:Router.php


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