本文整理汇总了PHP中Illuminate\Http\Request::getUri方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getUri方法的具体用法?PHP Request::getUri怎么用?PHP Request::getUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Http\Request
的用法示例。
在下文中一共展示了Request::getUri方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$pipe = $request->pipe;
if ($pipe) {
$finalServer = $this->resolver->resolve($pipe);
if ($finalServer != $request->getHttpHost()) {
return redirect(str_replace($request->getHttpHost(), $finalServer, $request->getUri()), 307);
}
}
return $next($request);
}
示例2: getLocalizedUrl
/**
* Returns the current URL adapted to $locale.
*
* @param string $locale
* @throws \Kevindierkx\LaravelDomainLocalization\UnsupportedLocaleException
* @return string
*/
public function getLocalizedUrl($locale)
{
// We validate the supplied locale before we mutate the current URL
// to make sure the locale exists and we don't return an invalid URL.
$this->validateLocale($locale);
return str_replace($this->getTld(), $this->getTldForLocale($locale), $this->request->getUri());
}
示例3: index
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request, $name)
{
$bbs = Bbs::where('name', $name)->firstOrFail();
$posts = $bbs->posts;
$requestUri = urlencode($request->getUri());
return view('post.index', ['bbs' => $bbs, 'posts' => $posts, 'requestUri' => $requestUri]);
}
示例4: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
$app = app();
$routeName = $app['locale']->getRouteNameFromAPath($request->getUri());
$app['locale']->setRouteName($routeName);
return $next($request);
}
示例5: handle
/**
* Handle an incoming request.
*
* @param LaravelRequest $request
* @param Closure $next
*
* @return mixed
*/
public function handle(LaravelRequest $request, Closure $next)
{
$message = new Request($request->getMethod(), new Uri($request->getUri()), $request->headers->all(), $request->getContent());
$result = $this->extractor->getRequest($message);
$event = $this->logger->begin($result['request'], $request->getUri(), $request->getMethod(), '');
$response = null;
try {
/** @var LaravelResponse $response */
$response = $next($request);
} catch (Exception $e) {
$response = LaravelResponse::create($e->getMessage(), 500);
} finally {
$this->logResponse($response, $event);
}
return $response;
}
示例6: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$matches = [];
$file = pathinfo($request->getUri());
preg_match_all('/(apple-touch-icon.*?\\.png|favicon(?:.*?)\\.(?:png|ico)|android-chrome.*?.png|manifest.json|safari-pinned-tab.svg|mstile.*?.png)/', $file['basename'], $matches);
$matches = array_filter($matches);
if (count($matches) > 1 && !file_exists(public_path($file['basename']))) {
abort(404);
}
return $next($request);
}
示例7: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$openid = Session::get('openid');
if (!$openid) {
\Log::info("not found openid in session");
$appid = Config::get("weixin.seller.appid");
Session::put('request_url', $request->getUri());
$authUrl = route("wx-auth");
\Log::info($authUrl);
$snsapi_base = sprintf(self::SNSAPI_BASE, config('wx_qy.corpID'), urlencode($authUrl), 'cy123456');
return redirect($snsapi_base);
}
\Log::info("success found openid in session");
return $next($request);
}
示例8: function
function it_handles_communication_logging(CommunicationLogger $logger, CommunicationExtractor $extractor, Request $request, Response $response, HeaderBag $requestHeaders, IEvent $event)
{
$request->getMethod()->shouldBeCalled()->willReturn('POST');
$request->getContent()->shouldBeCalled()->willReturn('request');
$request->getUri()->shouldBeCalled()->willReturn('http://example.com');
$request->headers = $requestHeaders;
$requestHeaders->all()->shouldBeCalled()->willReturn([]);
$next = function (Request $request) use($response) {
return new Response();
};
$extractor->getRequest(Argument::type(GuzzleRequest::class))->shouldBeCalled()->willReturn(['request' => 'request']);
$extractor->getResponse(Argument::type(GuzzleResponse::class))->shouldBeCalled()->willReturn(['response' => 'response']);
$logger->begin('request', 'http://example.com', 'POST', '')->shouldBeCalled()->willReturn($event);
$logger->end($event, 'response')->shouldBeCalled();
$this->handle($request, $next);
}
示例9: index
public function index(Request $request)
{
if ($request->getRequestUri() != '/') {
$buttonClick = $request->getUri();
}
//WEBSITE SETTINGS
$websiteSettings = Handler::readFile("websiteSettings.json");
$projects = Projects::orderBy('sortorder', 'asc')->get();
$lastProject = 0;
foreach ($projects as $key => $project) {
array_add($project, 'bootstrapColumn', Projects::bootstrapColumns($key));
array_add($project, 'imagePrefixName', Projects::imagePrefixName($key));
array_add($project, 'slug', Handler::createSlug($project->title, '-'));
$lastProject = $project->sortorder;
}
return view('website.index')->with(compact('websiteSettings', 'projects', 'lastProject', 'buttonClick'));
}
示例10: createRequest
/**
* Transforms a Symfony request into a PSR-7 request object
*
* @param \Illuminate\Http\Request $nativeRequest Laravel request object
* @return \Psr\Http\Message\ServerRequestInterface PSR-7 request object
*/
protected function createRequest(\Illuminate\Http\Request $nativeRequest)
{
$files = ServerRequestFactory::normalizeFiles($this->getFiles($nativeRequest->files->all()));
$server = ServerRequestFactory::normalizeServer($nativeRequest->server->all());
$headers = $nativeRequest->headers->all();
$cookies = $nativeRequest->cookies->all();
$post = $nativeRequest->request->all();
$query = $nativeRequest->query->all();
$method = $nativeRequest->getMethod();
$uri = $nativeRequest->getUri();
$body = new Stream('php://temp', 'wb+');
$body->write($nativeRequest->getContent());
$request = new ServerRequest($server, $files, $uri, $method, $body, $headers, $cookies, $query, $post);
foreach ($nativeRequest->attributes->all() as $key => $value) {
$request = $request->withAttribute($key, $value);
}
return $request;
}
示例11: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (env('APP_ENV') == 'local') {
//如果是本地,关闭微信身份验证,写死身份
Session::put('seller_id', 1);
} else {
$openid = Session::get('openid');
if (!$openid) {
\Log::info("not found openid in session");
$appid = Config::get("weixin.seller.appid");
Session::put('request_url', $request->getUri());
$authUrl = route("wxSellerAuth");
\Log::info($authUrl);
$snsapi_base = sprintf(self::SNSAPI_BASE, $appid, urlencode($authUrl), 'dajiayao123456');
return redirect($snsapi_base);
}
\Log::info("success found openid in session");
}
return $next($request);
}
示例12: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$exempt = false;
$walled_garden_enabled = Setting::get('walled-garden.enabled');
$exemptionPath = Setting::get('walled-garden.exemptions-path');
$exemptionsRegEx = Setting::get('walled-garden.exemptions-regex');
// Redirect to the login page if the user is not authenticated and the site
// is configured as a walled garden, except if the request is going to a page
// or route that is exempt from authentication.
if ($walled_garden_enabled) {
$authenticated = $this->auth->check();
if (!$authenticated) {
$requestURI = $request->getUri();
$requestPath = $request->path();
foreach ($exemptionPath as $exPath) {
if ($exPath == $requestPath) {
$exempt = true;
break;
}
}
if (!$exempt) {
foreach ($exemptionsRegEx as $regEx) {
if (preg_match($regEx, $requestPath)) {
$exempt = true;
break;
}
}
}
if (!$exempt) {
// $request->flashExcept(['password', 'password_confirmation']);
$request->session()->reflash();
return redirect()->guest('auth/login');
}
}
}
// Otherwise just continue on.
return $next($request);
}
示例13: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
$exempt = false;
$walled_garden = env('WALLED_GARDEN', false);
// TODO: Get these arrays from config.
$exemptionPath = ['/', 'home', 'faust', 'auth/login', 'auth/register', 'password/email', 'password/reset', '_debugbar/open', '_debugbar/assets/stylesheets', '_debugbar/assets/javascript'];
$exemptionsRegEx = ['/password\\/reset\\/.*/'];
// Redirect to the login page if the user is not authenticated and the site
// is configured as a walled garden, except if the request is going to a page
// or route that is exempt from authentication.
if ($walled_garden) {
$authenticated = $this->auth->check();
if (!$authenticated) {
$requestURI = $request->getUri();
$requestPath = $request->path();
foreach ($exemptionPath as $exPath) {
if ($exPath == $requestPath) {
$exempt = true;
break;
}
}
if (!$exempt) {
foreach ($exemptionsRegEx as $regEx) {
if (preg_match($regEx, $requestPath)) {
$exempt = true;
break;
}
}
}
if (!$exempt) {
return redirect()->guest('auth/login');
}
}
}
// Otherwise just continue on.
return $next($request);
}
示例14: buildKey
/**
* Builds the key which is used to store the content
*
* @param Request $request The request sent by the browser
* @return string The key of the content to store
*/
private static function buildKey(Request $request)
{
return 'EventixCache_' . str_slug($request->getUri());
}
示例15: cacheKey
/**
* Return the cache key for this request
*
* @return boolean
*/
public function cacheKey()
{
return $this->isCacheable() ? md5($this->request->getUri()) : null;
}