Reputation: 23171
How can I check if the $_SERVER['REQUEST_URI']
is empty (i.e. user visited domain.com/
), but leave an exception for if there is a $_GET
in the URL (domain.com/?a=1
)
Upvotes: 0
Views: 3630
Reputation: 95101
You can use parse_url
to achieve this
if(parse_url($_SERVER['REQUEST_URI'],PHP_URL_QUERY) !== null)
{
// It Contains get
var_dump($_SERVER['REQUEST_URI']);
}
Upvotes: 2