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