$v){ //遍历 $check= preg_match($pregs,$v); if($check == 1){ $int_arr = array('status'=>1,'result'=>$str,'message'=>'检测含有特殊字符'); }else{ $int_arr = array('status'=>0,'result'=>$str,'message'=>'检测没有特殊字符'); } } }else if(TestArray($str) == 2){ //二维数组 foreach($str as $k=>$v){ foreach($v as $ks=>$vs){ //遍历 $check= preg_match($pregs,$v); if($check == 1){ $int_arr = array('status'=>1,'result'=>$str,'message'=>'检测含有特殊字符'); }else{ $int_arr = array('status'=>0,'result'=>$str,'message'=>'检测没有特殊字符'); } } } } }else if(is_string($str)){ //字符串 $check= preg_match($pregs,$str); if($check == 1){ $int_arr = array('status'=>1,'result'=>$str,'message'=>'检测含有特殊字符'); }else{ $int_arr = array('status'=>0,'result'=>$str,'message'=>'检测没有特殊字符'); } } return $int_arr['status']; } //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ?>