本文整理汇总了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");
}
}
示例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();
}
示例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);
}