PHP過濾數據

<?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])); } } } ?>
相關文章
相關標籤/搜索