时间:2021-07-01 10:21:17 帮助过:3人阅读
public function strip_selected_tags($text, $tags = array())
{
$args = func_get_args();
$text = array_shift($args);
$tags = func_num_args() > 2 ? array_diff($args,array($text)) : (array)$tags;
foreach ($tags as $tag){
if(preg_match_all('/<'.$tag.'[^>]*>(.*)<\/'.$tag.'>/iU', $text, $found)){
$text = str_replace($found[0],$found[1],$text);
}
}
return $text;
}
$text = '行为准则的撒的发的是发烧的发的';
echo strip_tags($text);
echo strip_tags($text, '');