當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。