Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Remove all attributes from HTML tags in PHP

$text = '<div class="test"><p onmousemove="javascript:alert(1);">Clean <a href="#">text</a></p></div>';

$cleanText = preg_replace("/<([a-z][a-z0-9]*)[^>]*?(/?)>/si",'<$1$2>', $text);
Source by phpf1.com #
 
PREVIOUS NEXT
Tagged: #Remove #attributes #HTML #tags #PHP
ADD COMMENT
Topic
Name
1+4 =