How to remove
tags and more from a string?

前端 未结 7 1659
一生所求
一生所求 2020-12-04 00:08

I need to strip all
and all \'quotes\' (\") and all \'ands\' (&) and replace them with a space only ...

How c

相关标签:
7条回答
  • 2020-12-04 01:13
    <?php
    
    $text = '<p>Test paragraph.</p><!-- Comment --> <a href="#fragment">Other text</a>';
    echo strip_tags($text);
    echo "\n";
    // Allow <p> and <a>
    echo strip_tags($text, '<p><a>');
    
    ?>
    

    http://php.net/manual/en/function.strip-tags.php

    0 讨论(0)
提交回复
热议问题