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


PHP Request::getScheme方法代码示例

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


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

示例1: getScheme

 /**
  * Get the scheme for a raw URL.
  *
  * @param  bool|null  $secure
  * @return string
  */
 protected function getScheme($secure)
 {
     if (is_null($secure)) {
         return $this->forceSchema ?: $this->request->getScheme() . '://';
     }
     return $secure ? 'https://' : 'http://';
 }
开发者ID:HarveyCheng,项目名称:myblog,代码行数:13,代码来源:UrlGenerator.php

示例2: handle

 /**
  * Handle an incoming request, check to see if we have a redirect in place for the requested URL
  * and then redirect if we do have a match
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // Get the full URL that has been requested, minus the protocol
     $full_url = str_replace($request->getScheme() . "://", "", $request->url());
     // Check for any results matching the full domain request
     $results = Redirect::where("type", "domain")->where("from", $full_url)->where("status", "active");
     if ($results->exists()) {
         // Get the first result back
         $redirect = $results->first();
         // Grab the URL before we increment
         $url = $redirect->to;
         // Increment the hit count
         $redirect->increment('hits');
         // Redirect off to where we're going
         return RedirectFacade::to($url);
     }
     // Check for any results matching the path only
     $results = Redirect::where("type", "path")->where("from", "/" . $request->path())->where("status", "active");
     // If a redirect exists for this, process it and redirect
     if ($results->exists()) {
         // Get the first result back
         $redirect = $results->first();
         // Grab the URL before we increment
         $url = $redirect->to;
         // Increment the hit count
         $redirect->increment('hits');
         // Redirect off to where we're going
         return RedirectFacade::to($url, 301);
     }
     // By default, continue afterwards and bail out
     return $next($request);
 }
开发者ID:ssx,项目名称:threeohone,代码行数:40,代码来源:CheckForRedirect.php

示例3: localizedURL

 /**
  * Returns an URL adapted to locale
  *
  * @param  string $locale
  * @return string
  */
 private function localizedURL($locale)
 {
     // Default language doesn't get a special subdomain
     $locale = $locale !== $this->defaultLocale ? strtolower($locale) . '.' : '';
     // URL elements
     $uri = $this->request->getRequestUri();
     $scheme = $this->request->getScheme();
     // Get host
     $array = explode('.', $this->request->getHttpHost());
     $host = (array_key_exists(count($array) - 2, $array) ? $array[count($array) - 2] : '') . '.' . $array[count($array) - 1];
     // Create URL from template
     $url = str_replace(['[scheme]', '[locale]', '[host]', '[uri]'], [$scheme, $locale, $host, $uri], $this->config['locale_url']);
     return url($url);
 }
开发者ID:torann,项目名称:laravel-meta-tags,代码行数:20,代码来源:MetaTag.php

示例4: getLocalizedURL

 /**
  * Returns an URL adapted to $locale
  *
  * @throws SupportedLocalesNotDefined
  * @throws UnsupportedLocaleException
  *
  * @param  string|boolean $locale     Locale to adapt, false to remove locale
  * @param  string|false   $url        URL to adapt in the current language. If not passed, the current url would be
  *                                    taken.
  * @param  array          $attributes Attributes to add to the route, if empty, the system would try to extract
  *                                    them from the url.
  *
  *
  * @return string|false                URL translated, False if url does not exist
  */
 public function getLocalizedURL($locale = null, $url = null, $attributes = [])
 {
     // Use default if not set
     if ($locale === null) {
         $locale = $this->getCurrentLocale();
     }
     // Get request Uri
     if (empty($url)) {
         $url = $this->request->getRequestUri();
     } else {
         $parts = parse_url($url);
         $url = $parts['path'] . (isset($parts['query']) ? '?' . $parts['query'] : '');
     }
     $scheme = $this->request->getScheme();
     $locale = $locale && $locale !== $this->getDefaultLocale() ? "{$locale}." : '';
     // Get host
     $array = explode('.', $this->request->getHttpHost());
     $host = (array_key_exists(count($array) - 2, $array) ? $array[count($array) - 2] : '') . '.' . $array[count($array) - 1];
     return app('url')->to("{$scheme}://{$locale}{$host}{$url}", $attributes);
 }
开发者ID:torann,项目名称:localization,代码行数:35,代码来源:LocaleManager.php

示例5: getScheme

 /**
  * Gets the request's scheme.
  *
  * @return string 
  * @static 
  */
 public static function getScheme()
 {
     //Method inherited from \Symfony\Component\HttpFoundation\Request
     return \Illuminate\Http\Request::getScheme();
 }
开发者ID:satriashp,项目名称:tour,代码行数:11,代码来源:_ide_helper.php

示例6: setRequestData

 /**
  * @param $data
  * @return array
  */
 protected function setRequestData(array $data)
 {
     $data['original_headers'] = $this->httpRequest->headers->all();
     $data['request'] = ['host' => $this->httpRequest->getHost(), 'method' => $this->httpRequest->method(), 'scheme' => $this->httpRequest->getScheme()];
     return $data;
 }
开发者ID:iyoworks,项目名称:ipn-forwarder,代码行数:10,代码来源:SimpleFormatter.php

示例7: getRequestContext

 /**
  * @param \Illuminate\Http\Request $request
  * @return string
  */
 public function getRequestContext(Request $request)
 {
     return implode('.', [$request->getScheme(), strtolower($request->getMethod()), $this->guessRequestType($request), '_' . $this->quotePath($request->getPathInfo())]);
 }
开发者ID:exolnet,项目名称:laravel-instruments,代码行数:8,代码来源:Instruments.php


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