Home>Article>Web Front-end> How to delete html comments
How to delete html comments: first open the corresponding code file; then delete the html comments through the "function remove_html_comments($content = ''){...}" method.
The operating environment of this article: Windows7 system, HTML5&&CSS3 version, Dell G3 computer.
The content of the comments in the html can be deleted using regular expressions.
Generally the way to write HTML comments is f80737884d6c93a4ecaeac0ca41583ac
b7eed15494c5e94925ac29cde8f7bece
You can use the following custom methods to delete useless comments:
function remove_html_comments($content = '') { return preg_replace('//', '', $content); }
The input parameter is content, and preg_replace is regular replacement. , the rule is ed063da33f91bb19b178aaf57d56a83b
[Recommended learning:HTML video tutorial]
The above is the detailed content of How to delete html comments. For more information, please follow other related articles on the PHP Chinese website!