PHP - remove HTML tags from string except <img> [closed]
I want to remove all tags except the img tag,
$words = strip_tags($words, '<img>');
Is it useful?
Yes, to remove tags.
But strip_tags()
won't help against the most dangerous thing - an XSS. You will need some regular expression, or use http://htmlpurifier.org/ to be sure there are no unwanted parameters in the <img>
tag.
精彩评论