Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

$_GET without foo

Tags:

url

php

get

How can I use download.php?get=file.exe with without the get variable, like download.php?=file.exe, using the $_GET in PHP?

like image 730
Sindre Sorhus Avatar asked Dec 03 '22 15:12

Sindre Sorhus


2 Answers

You can use $_GET[0] or $_REQUEST[0]

like image 113
Pooria Avatar answered Dec 06 '22 05:12

Pooria


You could use $_SERVER['request_uri'] which would allow you to omit the ? completely, leaving you with URLs like example.com/download.php/file.exe

Then, with a bit of URL rewriting (or implementing a bootstrap controller) you could clean it up even more, resulting in example.com/download/file.exe

like image 24
Michael Wales Avatar answered Dec 06 '22 06:12

Michael Wales