function stripSingleEndedTag($content, $allowed = array()){
(array)$allowed;
$singletags = array('<meta>','<img>','<input>','<hr>','<br>','<link>','<isindex>','<base>','<meta>','<nextid>','<bork>');
$stripthese = arrayfilterout ($singletags, $allowed);
$stripthese = str_replace(array('<','>'),'',$stripthese);
$pattern = '/<('. implode('|', $stripthese) .')[^>]+\>/i';
$content = preg_replace($pattern, "", $content);
return $content;
}
私がここに持っているもの<bork />
は、「bork」の後と「>」の前に何らかの文字がある場合に限り、シングルエンドのタグを取り除きます。 <bork >
削除され<bork/>
ますが、削除されません<bork>
ところで、使えませんstrip_tags()
。