remove comments from html source code

前端 未结 5 502
深忆病人
深忆病人 2020-12-20 13:13

I know how to get the html source code via cUrl, but I want to remove the comments on the html document (I mean what is between ). In addition,

5条回答
  •  醉酒成梦
    2020-12-20 14:04

    Regex solved this problem for me as follows:

    function remove_html_comments($html = '') {
        return preg_replace('//', '', $html);
    }
    

提交回复
热议问题