Stripping html tags using php
问题 How can i strip html tag except the content inside the pre tag code $content=" <div id="wrapper"> Notes </div> <pre> <div id="loginfos">asdasd</div> </pre> "; While using strip_tags($content,'') the html inside the pre tag too stripped of. but i don't want the html inside pre stripped off 回答1: You may do the following: Use preg_replace with 'e' modifier to replace contents of pre tags with some strings like @@@1@@@, @@@2@@@, etc. while storing this contents in some array Run strip_tags() Run