//ajax获得参数简写函数
function reajax($name='i',$code=2,$type=false,$nounajaxcode){
//$code:0=不编码,1=htmlspecialchars,2=mysql_real_escape_string
//$type:false=post,true=get
//$nounajaxcode:是否不还原ajaxcode编码
if ($type){
$b=$_GET[$name];
}else{
$b=$_POST[$name]; //默认
}
$b=trim(read_utf8_uns($b));
if (!$nounajaxcode) $b=unajaxcode($b);
switch ($code){
case 1:
$b=htmlspecialchars($b);
break;
case 2:
$b=mysql_real_escape_string($b); //默认
break;
}
return $b;
}
现在这三个参数都是可选的。
reajax()≌mysql_real_escape_string(unajaxcode(trim(read_utf8_uns($_POST['i']))))