<?php
//处理输入数据
//过滤引号
//过滤html标签
class Input{
public static function get($name=''){
if(empty($name)){
$arrGet=array();
foreach ($_GET as $key => $value) {
$arrGet[$key]=mysqli_real_escape_string(htmlspecialchars($value));
}
return $arrGet;
}else{
return mysqli_real_escape_string(htmlspecialchars($_GET[$name]));
}
}
public static function intQuery($name='id'){
return (int)$_GET[$name];
}
public static function post($name=''){
if(empty($name)){
$arrPost=array();
foreach ($_POST as $key => $value) {
$arrPost[$key]=mysqli_real_escape_string(htmlspecialchars($value));
}
return $arrPost;
}else{
return mysqli_real_escape_string(htmlspecialchars($_POST[$name]));
}
}
}
?>