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


PHP Request::getHttpHost方法代码示例

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


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

示例1: makeInternalLinksRelative

 /**
  * Make links which include the current HTTP host relative, even if the scheme doens't match.
  *
  * Internal links within text are stored as relative links so that if a site moves host
  * or the database is copied to another site (e.g. development or staging versions)
  * the links will still work correctly.
  *
  * @param string $text
  *
  * @return string
  */
 public static function makeInternalLinksRelative($text)
 {
     if ($base = Request::getHttpHost()) {
         return preg_replace("|<(.*?)href=(['\"])(https?://)" . $base . "/(.*?)(['\"])(.*?)>|", '<$1href=$2/$4$5$6>', $text);
     }
     return $text;
 }
开发者ID:robbytaylor,项目名称:boom-core,代码行数:18,代码来源:Str.php

示例2: factory

 public static function factory($link)
 {
     $link = preg_replace('|^https?://' . Request::getHttpHost() . '|', '', $link);
     if (is_int($link) || ctype_digit($link) || substr($link, 0, 1) == '/') {
         $internal = new Internal($link);
         // If it's not a valid CMS URL then it's a relative URL which isn't CMS managed so treat it as an external URL.
         return $internal->isValidPage() ? $internal : new External($link);
     } else {
         return new External($link);
     }
 }
开发者ID:robbytaylor,项目名称:boom-core,代码行数:11,代码来源:Link.php

示例3: compose

 /**
  * Bind data to the view.
  *
  * @param  View  $view
  * @return void
  */
 public function compose(View $view)
 {
     // Are we connecting from a known URL?
     if ($airline = Airline::where('url', '=', Request::getHttpHost())->first()) {
         Session::put('airlineId', $airline->id);
     }
     if (Session::has('airlineId')) {
         $view->with('airline', Airline::find(Session::get('airlineId')));
     }
     if (Request::user()) {
         $view->with('user', Request::user());
         $view->with('pilot', PilotRepository::getCurrentPilot());
         $airline = Airline::find(Session::get('airlineId'));
         $view->with('airlineStaff', UserRepository::hasRole($airline->prefix . '-staff', Request::user()));
     }
 }
开发者ID:aorly,项目名称:vAMSYS,代码行数:22,代码来源:GlobalComposer.php

示例4: makeRelative

 public static function makeRelative($url)
 {
     return ($base = Request::getHttpHost()) ? str_replace(Request::getScheme() . $base, '/', $url) : $url;
 }
开发者ID:robbytaylor,项目名称:boom-core,代码行数:4,代码来源:URL.php

示例5: makeRelative

 public static function makeRelative($url)
 {
     return preg_replace('|^https?://' . Request::getHttpHost() . '|', '', $url);
 }
开发者ID:boomcms,项目名称:boom-core,代码行数:4,代码来源:URL.php


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