下面来看一下吧,这款php表单验证类用来判断过滤form来的值哦。
class post_get{
private $array; #提交表单检测字段和检测要求
# $type; 缺省为更新 或$type ="Into";
public function _post_get($array,$type=""){
if(!$array) die(" Error!! ");
foreach ($array as $v)
{
$KK = $this->ck_split($v);
$KKarray = split("_", $KK);
if(preg_match("/Yes|No/is",$KKarray[1]))
{
$escape_filter = ($KKarray[2])? 'ck_'.$KKarray[2]:"";#需要转义和过滤
$data = ($escape_filter)? $this->$escape_filter($_POST[$KKarray[0]]):$_POST[$KKarray[0]]; #输出合法