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


PHP Request::root方法代码示例

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


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

示例1: configAssetUrl

 /**
  * Generate a URL to an application asset.
  *
  * @param  string  $path
  * @param  bool    $secure
  * @return string
  */
 protected function configAssetUrl($path, $secure = null)
 {
     static $assetUrl;
     // Remove this.
     $i = 'index.php';
     if (URL::isValidUrl($path)) {
         return $path;
     }
     // Finding asset url config.
     if (is_null($assetUrl)) {
         $assetUrl = \Config::get('theme.assetUrl', '');
     }
     // Using asset url, if available.
     if ($assetUrl) {
         $base = rtrim($assetUrl, '/');
         // Asset URL without index.
         $basePath = str_contains($base, $i) ? str_replace('/' . $i, '', $base) : $base;
     } else {
         if (is_null($secure)) {
             $scheme = Request::getScheme() . '://';
         } else {
             $scheme = $secure ? 'https://' : 'http://';
         }
         // Get root URL.
         $root = Request::root();
         $start = starts_with($root, 'http://') ? 'http://' : 'https://';
         $root = preg_replace('~' . $start . '~', $scheme, $root, 1);
         // Asset URL without index.
         $basePath = str_contains($root, $i) ? str_replace('/' . $i, '', $root) : $root;
     }
     return $basePath . '/' . $path;
 }
开发者ID:fabriciorabelo,项目名称:laravel-theme,代码行数:39,代码来源:AssetContainer.php

示例2: anyIndex

 public function anyIndex()
 {
     //获取路由传入的参数
     //echo Route::input('name');
     //获取配置信息
     $value = config('app.timezone');
     //var_dump($value);
     //获取请求输入  http://host-8/web/user?name=dfse  输出:dfse
     $name1 = Request::has('name') ? Request::get('name') : '';
     //取得特定输入数据,若没有则取得默认值
     $name2 = Request::input('name', '默认值');
     $input = Request::all();
     //所有的
     $input = Request::input('products.0.name');
     //重定向
     //return redirect('login');
     //获取cookie
     $value = Request::cookie('name');
     //获取域名
     $url = Request::root();
     //		echo $url;
     $data = ['url' => $url, 'name1' => $name1, 'name2' => $name2, 'value' => $value];
     //响应视图   响应最常用的几个方法:make/view/json/download/redirectTo
     return response()->view('user.user', $data);
 }
开发者ID:breeze323136,项目名称:laravel,代码行数:25,代码来源:UserController.php

示例3: getIndex

 /**
  * Returns the setup page.
  *
  * @return \Illuminate\View\View
  */
 public function getIndex()
 {
     // If we've copied the .env.example file, then we should try and reset it.
     if (getenv('APP_KEY') === 'SomeRandomString') {
         $this->keyGenerate();
     }
     return View::make('setup')->withPageTitle(trans('setup.setup'))->withCacheDrivers($this->cacheDrivers)->withAppUrl(Request::root());
 }
开发者ID:kulado,项目名称:Cachet,代码行数:13,代码来源:SetupController.php

示例4: getIndex

 /**
  * Returns the setup page.
  *
  * @return \Illuminate\View\View
  */
 public function getIndex()
 {
     // If we've copied the .env.example file, then we should try and reset it.
     if (getenv('APP_KEY') === 'SomeRandomString') {
         $this->keyGenerate();
     }
     return View::make('setup')->with(['page_title' => trans('setup.setup'), 'cacheDrivers' => $this->cacheDrivers, 'appUrl' => Request::root()]);
 }
开发者ID:n0mer,项目名称:Cachet,代码行数:13,代码来源:SetupController.php

示例5: getIndex

 /**
  * Returns the setup page.
  *
  * @return \Illuminate\View\View
  */
 public function getIndex()
 {
     $supportedLanguages = Request::getLanguages();
     $userLanguage = Config::get('app.locale');
     foreach ($supportedLanguages as $language) {
         $language = str_replace('_', '-', $language);
         if (isset($this->langs[$language])) {
             $userLanguage = $language;
             break;
         }
     }
     return View::make('setup')->withPageTitle(trans('setup.setup'))->withCacheDrivers($this->cacheDrivers)->withMailDrivers($this->mailDrivers)->withUserLanguage($userLanguage)->withAppUrl(Request::root());
 }
开发者ID:aksalj,项目名称:Cachet,代码行数:18,代码来源:SetupController.php

示例6: getIndex

 /**
  * Returns the setup page.
  *
  * @return \Illuminate\View\View
  */
 public function getIndex()
 {
     // If we've copied the .env.example file, then we should try and reset it.
     if (strlen(Config::get('app.key')) !== 32) {
         $this->keyGenerate();
     }
     $supportedLanguages = Request::getLanguages();
     $userLanguage = Config::get('app.locale');
     foreach ($supportedLanguages as $language) {
         $language = str_replace('_', '-', $language);
         if (isset($this->langs[$language])) {
             $userLanguage = $language;
             break;
         }
     }
     return View::make('setup')->withPageTitle(trans('setup.setup'))->withCacheDrivers($this->cacheDrivers)->withUserLanguage($userLanguage)->withAppUrl(Request::root());
 }
开发者ID:mohitsethi,项目名称:Cachet,代码行数:22,代码来源:SetupController.php

示例7: generateUrl

 /**
  * check if package is surpassed or not then
  * prepare the path before generating the url.
  *
  * @param        $path
  * @param string $prepend
  *
  * @return mixed
  */
 private function generateUrl($path, $prepend = '')
 {
     // if the package is surpassed, then return the same $path
     // to load the asset from the localhost
     if (isset($this->configurations['bypass']) && $this->configurations['bypass']) {
         return Request::root() . '/' . $path;
     }
     if (!isset($path)) {
         throw new EmptyPathException('Path does not exist.');
     }
     // Add version number
     //$path = str_replace(
     //    "build",
     //    $this->configurations['providers']['aws']['s3']['version'],
     //    $path
     //);
     // remove slashes from begging and ending of the path
     // and append directories if needed
     $clean_path = $prepend . $this->helper->cleanPath($path);
     // call the provider specific url generator
     return $this->provider->urlGenerator($clean_path);
 }
开发者ID:codenut,项目名称:cdn,代码行数:31,代码来源:CdnFacade.php

示例8: returnTo

 /**
  * Defines the Form Back Button destination
  * @return string
  */
 protected function returnTo()
 {
     $fallback = Request::root() . "/" . Request::segment(1);
     if (explode("?", $this->_referer)[0] == $fallback) {
         return "javascript:history.go(-1)";
     } else {
         return $fallback;
     }
 }
开发者ID:wemersonrv,项目名称:crudbase,代码行数:13,代码来源:CrudBaseController.php


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