Laravel superglobals cheat sheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$_SERVER['HTTP_HOST'] = Request::getHttpHost(); | |
$_SERVER['HTTP_HOST'] = request()->getHttpHost(); | |
// Alternative could be to use URL::previous(), but this will always return current URL if no referer is present. | |
// @see https://github.com/laravel/framework/blob/5.7/src/Illuminate/Routing/UrlGenerator.php#L154 | |
$_SERVER['HTTP_REFERER'] = Request::header('referer', 'default'); | |
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = Request::getPreferredLanguage(); | |
$_SERVER['HTTP_USER_AGENT'] = Request::userAgent(); | |
$_SERVER['REQUEST_URI'] = Request::getRequestUri(); | |
$_SERVER['REQUEST_URI'] = request()->getRequestUri(); | |
$_SERVER['SERVER_NAME'] = Request::server('SERVER_NAME'); | |
$_GET['foo'] = Request::query('foo'); | |
$_POST['foo'] = Request::input('foo'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment