getgpc($k, $t='GP'),怎么返回的是 NULL?

时间:2022-05-22 22:22:40
<?php
/**
* 实用小代码
* 获得GET POST COOKIS
*/
$html=<<<WORD
<form method="post">
<p>First name: <input type="text" name="fname" /></p>
<p>Last name: <input type="text" name="lname" /></p>
<input type="submit" value="Submit" />
</form>
WORD;
ECHO $html;
//var_dump($_GET);
var_dump($_POST); function getgpc($k, $t='GP') {
$t = strtoupper($t);
switch($t) {
case 'GP' : isset($_POST[$k]) ? $var = &$_POST : $var = &$_GET; break;
case 'G': $var = &$_GET; break;
case 'P': $var = &$_POST; break;
case 'C': $var = &$_COOKIE; break;
case 'R': $var = &$_REQUEST; break;
}
return $var[$k];
return isset($var[$k]) ? $var[$k] : null;
} $view_off = getgpc('view_off');
var_dump($view_off);

求解,万能的PHP圈友为什么返回的是NULL 值 。