本文整理汇总了PHP中Illuminate\Http\Request::decodedPath方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::decodedPath方法的具体用法?PHP Request::decodedPath怎么用?PHP Request::decodedPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Http\Request
的用法示例。
在下文中一共展示了Request::decodedPath方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Return 404s for missing files and redirect to index.html for directories
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
// File path requested
$path = $request->decodedPath();
// Remove any repeated slashes
$path = preg_replace('#//+#', '/', $path);
// If user requested / explicitly redirect them to index.html
if ($path == '/') {
return redirect('index.html', 301);
}
// Handle requests for missing files
if (!$this->fs->has($path)) {
$this->logger->warning('File not found (cache miss)', array('path' => $path));
abort(404);
}
// If request is for directory, redirect to index.html in that directory
$metaData = $this->fs->getMetadata($path);
if ($metaData['type'] == 'dir') {
$path .= '/index.html';
return redirect($path, 301);
}
// Forward to Controller for content & modified time
return $next($request);
}
示例2: denyRequest
private function denyRequest()
{
// Store return path to allow redirect after auth, ...
\Session::put('laraguard_lastDenied', $this->request->decodedPath());
\Session::put('laraguard_lastDeniedLifetime', $this->permissionParser->getDeniedUrlLifetime());
// Redirect to permissionDenied method of controller
if ($this->requestParser->hasControllerPermissionDeniedMethod()) {
// Modify request action to direct to method 'permissionDenied'
$action = $this->request->route()->getAction();
$controllerPath = $this->requestParser->getControllerPath();
$action['uses'] = $controllerPath . '@permissionDenied';
$action['controller'] = $controllerPath . '@permissionDenied';
// Set new action
$this->request->route()->setAction($action);
if ($this->permissionParser->debugging()) {
\Log::info('[Laraguard] DENY - with permissionDenied(): ' . $action['uses']);
}
return \Route::dispatch($this->request);
} else {
if ($this->permissionParser->hasNoPermissionRoute()) {
$noPermissionRoute = $this->permissionParser->getNoPermissionRoute();
if ($this->permissionParser->debugging()) {
\Log::info('[Laraguard] DENY - with defaultNoPermissionRoute: ' . $noPermissionRoute);
}
return redirect($noPermissionRoute);
} else {
if ($this->permissionParser->debugging()) {
\Log::info('[Laraguard] DENY - with 501 Error');
}
return $this->returnError(['Permission denied']);
}
}
}
示例3: decodedPath
/**
* Get the current encoded path info for the request.
*
* @return string
* @static
*/
public static function decodedPath()
{
return \Illuminate\Http\Request::decodedPath();
}
示例4: bindPathParameters
/**
* Get the parameter matches for the path portion of the URI.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
protected function bindPathParameters(Request $request)
{
preg_match($this->compiled->getRegex(), '/' . $request->decodedPath(), $matches);
return $matches;
}
示例5: getEmailDatas
/**
* get error email datas
*
* @param \Illuminate\Http\Request $request
* @param Exception $e
* @return array
*/
private function getEmailDatas($request, $e)
{
return ['date' => Carbon::now()->format('d.m.Y H:i:s'), 'rUser' => $request->user(), 'rSessionOld' => $request->session()->all()['flash']['old'], 'rSessionNew' => $request->session()->all()['flash']['new'], 'rAll' => $request->all(), 'rIp' => $request->ip(), 'rDecodedPath' => $request->decodedPath(), 'rPath' => $request->path(), 'rFullUrl' => $request->fullUrl(), 'rUrl' => $request->url(), 'rRoot' => $request->root(), 'rMethod' => $request->method(), 'eMessage' => method_exists($e, 'getMessage') ? $e->getMessage() : '', 'eCode' => method_exists($e, 'getStatusCode') ? $e->getStatusCode() : 200, 'eFile' => method_exists($e, 'getFile') ? $e->getFile() : '', 'eLine' => method_exists($e, 'getLine') ? $e->getLine() : '', 'ePrevious' => is_string($e->getPrevious()) ? $e->getPrevious() : '', 'eTrace' => nl2br($e->getTraceAsString())];
}
示例6: index
public function index(Request $request)
{
print_r($request->all());
print_r($request->decodedPath());
}