& lt ;? Php $ text = '& lt; P & gt; Test & lt; Br />paragraph.</p><!-- comment - - & gt; & Lt; A href = "# piece" & gt; Other text & lt; / A & gt; '; Echo strip_tags ($ text); Echo "\ n"; // Allow & lt; P & gt ;, & lt; A & gt;, & lt; Br / & gt; Echo Strip_tags ($ text, ' & gt; & lt; br / & gt;';); Echo "\ n"; // Allow & lt; Br / & gt; Only echo strip_tags ($ text, '
Result:
test paragraphs other text & lt; P & gt; Test Paragraphs & Lt; / P & gt; & Lt; A href = "# piece" & gt; Other text & lt; / A & gt; Test Paragraph Other Text
Thanks, Bring
using one Do not auto-click tag names? echo strip_tags ($ text, '& br>');
the strip_tags ()
function takes the acceptable_tag
argument & lt; Tagname & gt; The code accepted as
was not the result of your code because you have & lt; Br / & gt; Instead of
& lt; Br & gt;
.
Comments
Post a Comment