用作GET和POST参数的单个变量[重复]

How to use as a single variable to access $_GET or $_POST params.

what I want exactly to do is to write less code in PHP, for example :

if ($_GET['hello']==="hello") echo "hello get";
else if($_POST['hello'] === "hello post") echo "hello post";

to covert to something like

if( $_SERVER['REQUEST_METHOD']['hello'] === "hello" ) echo "hello ".$_SERVER['REQUEST_METHOD'];
</div>

You can use $_REQUEST. This will get both

e.g

$_REQUEST['hello'] === "hello"

and complete:

if ($_REQUEST['hello'] === "hello") echo "Hello ".$_SERVER['REQUEST_METHOD'];

$_REQUEST Documentation