//过滤HTML标签
function formatString($str){
$preg = "/<\/?[^>]+>/i";
//判断是否 为数组
if(!is_array($str)){
return preg_replace($preg,'',$str);
}else{
foreach ($str as $k => $v) {
//判断$V是否是多维数组
if(is_array($v)) $str[$k][$v] = formatString($v);
else{$str[$k][$v] = preg_replace($preg,'',$v);}
}
return $str;
}
return $str;
}
已解决
//过滤HTML标签
function formatString($str){
$preg = "/</?[^>]+>/i";
$tree = array();
//判断是否 为数组
if(!is_array($str)){
return preg_replace($preg,'',$str);
}else{
foreach ($str as $k => $v) {
//判断$V是否是多维数组
if(is_array($v)){
$tree[$k] = formatString($v);
}else if(!is_array($v)){
$tree[$k] = preg_replace($preg,'',$v);
}
}
return $tree;
}
}