1、str_replace替换函数
str_replace( 被替换的值,替换的值,被替换的内容);
例:function htmtocode($content) {$content = str_replace("\n", "<br>", str_replace(" ", " ", $content));return $content;}
2、htmlspecialchars 格式化html
主要功能是将HTML格式化,防止在输出html时被浏览器执行htmlspecialchars(所要格式化对象,定义单双引号,编码)