當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Request::getPathInfo方法代碼示例

本文整理匯總了PHP中Illuminate\Support\Facades\Request::getPathInfo方法的典型用法代碼示例。如果您正苦於以下問題:PHP Request::getPathInfo方法的具體用法?PHP Request::getPathInfo怎麽用?PHP Request::getPathInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Support\Facades\Request的用法示例。


在下文中一共展示了Request::getPathInfo方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: boot

 public function boot()
 {
     if ($this->isRunningWithFacades() && !class_exists('Clockwork')) {
         class_alias('Clockwork\\Facade\\Clockwork', 'Clockwork');
     }
     if (!$this->app['clockwork.support']->isCollectingData()) {
         return;
         // Don't bother registering event listeners as we are not collecting data
     }
     if ($this->app['clockwork.support']->isCollectingDatabaseQueries()) {
         $this->app['clockwork.eloquent']->listenToEvents();
     }
     if (!$this->app['clockwork.support']->isEnabled()) {
         return;
         // Clockwork is disabled, don't register the route
     }
     /*
     |--------------------------------------------------------------------------
     | Debug routes
     |--------------------------------------------------------------------------
     */
     if (env('APP_DEBUG', false)) {
         $this->app->group(['middleware' => 'cors'], function () {
             $this->app->get('/__clockwork/{id}', ['as' => 'profiler.native', 'uses' => \Clockwork\Http\Profiler::class . '@getData']);
             $this->app->get('api/__profiler/profiles/', ['as' => 'profiler.list', 'uses' => \Clockwork\Http\Profiler::class . '@index']);
             $this->app->get('api/__profiler/profiles/stats', ['as' => 'profiler.stats', 'uses' => \Clockwork\Http\Profiler::class . '@stats']);
             $this->app->get('api/__profiler/profiles/last', ['as' => 'profiler.last', 'uses' => \Clockwork\Http\Profiler::class . '@last']);
             $this->app->get('api/__profiler/profiles/{id}', ['as' => 'profiler.show', 'uses' => \Clockwork\Http\Profiler::class . '@show']);
         });
     }
     /*
     |--------------------------------------------------------------------------
     | Override env configuration
     |--------------------------------------------------------------------------
     |
     | Disable profiler for profiler request
     |
     */
     $pathInfo = \Illuminate\Support\Facades\Request::getPathInfo();
     if (strpos($pathInfo, 'api/__profiler') > 0) {
         putenv("CLOCKWORK_COLLECT_DATA_ALWAYS=false");
         putenv("CLOCKWORK_ENABLE=false");
     }
 }
開發者ID:lahaxearnaud,項目名稱:clockwork,代碼行數:44,代碼來源:ClockworkServiceProvider.php

示例2: getPathInfo

 /**
  * Returns the path being requested relative to the executed script.
  *
  * The path info always starts with a /.
  *
  * Suppose this request is instantiated from /mysite on localhost:
  *
  *  * http://localhost/mysite              returns an empty string
  *  * http://localhost/mysite/about        returns '/about'
  *  * http://localhost/mysite/enco%20ded   returns '/enco%20ded'
  *  * http://localhost/mysite/about?var=1  returns '/about'
  *
  * @return string The raw path (i.e. not urldecoded)
  *
  * @api
  */
 public function getPathInfo()
 {
     return parent::getPathInfo();
 }
開發者ID:andrims21,項目名稱:eBri,代碼行數:20,代碼來源:Request.php

示例3: buildPagination

 /**
  * Build pagination link.
  *
  * @param  integer $total
  * @param  integer $offset
  * @param  integer $limit
  * @return string
  */
 private function buildPagination($total = 0, $offset = 0, $limit = 0)
 {
     $links = array();
     if ($total > 0) {
         $baseUrl = Request::getSchemeAndHttpHost() . Request::getPathInfo();
         // Create the first page link
         if ($offset > 0) {
             $param = array();
             $param['offset'] = 0;
             if (!empty($limit)) {
                 $param['limit'] = $limit;
             }
             $links[] = '<' . $baseUrl . '?' . http_build_query($param) . '>; rel="first"';
         }
         // Create the previous page link
         $prevOffset = $offset - $limit;
         if ($prevOffset > 0) {
             $param = array();
             $param['offset'] = $prevOffset;
             if (!empty($limit)) {
                 $param['limit'] = $limit;
             }
             $links[] = '<' . $baseUrl . '?' . http_build_query($param) . '>; rel="previous"';
         }
         // Create the next page link
         $nextOffset = $offset + $limit;
         if ($nextOffset < $total - $limit) {
             $param = array();
             $param['offset'] = $nextOffset;
             if (!empty($limit)) {
                 $param['limit'] = $limit;
             }
             $links[] = '<' . $baseUrl . '?' . http_build_query($param) . '>; rel="next"';
         }
         // Create the last page link
         if ($offset < $total - $limit) {
             $param = array();
             $param['offset'] = $total - $limit;
             if (!empty($limit)) {
                 $param['limit'] = $limit;
             }
             $links[] = '<' . $baseUrl . '?' . http_build_query($param) . '>; rel="last"';
         }
     }
     return implode(',', $links);
 }
開發者ID:WillymarJ,項目名稱:Your-Laravel-Api,代碼行數:54,代碼來源:User.php


注:本文中的Illuminate\Support\Facades\Request::getPathInfo方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。