三元运算
//三元运算
function getParam($param, $type, $default = '')
{
switch ($type)
{
case 'POST' :
$result = lib_replace_end_tag(trim($_POST[$param]));
break;
case 'GET' :
$result = lib_replace_end_tag(trim($_GET[$param]));
break;
default :
$result = lib_replace_end_tag(trim($_POST[$param] ? $_POST[$param] : $_GET[$param]));
break;
}
$result = $result == '' ? $default : $result;
return $result;
}
POST:
getParam('yunli', 'post', '普通');
GET :
getParam('yunli', 'get', '普通');
$title = getParam('title', 'get', '标题');
$yunli = getParam('yunli', 'post', '普通');
$email = getParam('email', 'post');//不用默认值

浙公网安备 33010602011771号