strip_tags(html)

Strips all HTML tags from the html, including comments. This uses the html-scanner tokenizer and so its HTML parsing ability is limited by that of html-scanner.

 

Ruby代码  收藏代码
    1. strip_tags("Strip <i>these</i> tags!")  
    2. # => Strip these tags!  
    3.   
    4. strip_tags("<b>Bold</b> no more!  <a href='more.html'>See more here</a>...")  
    5. # => Bold no more!  See more here...  
    6.   
    7. strip_tags("<div id='top-bar'>Welcome to my website!</div>")  
    8. # => Welcome to my website! 
posted @ 2013-11-07 11:41  小狸的窝  阅读(233)  评论(0)    收藏  举报