4591566 发表于 2017-3-30 10:48:01

php里的函数

1、str_replace替换函数



str_replace( 被替换的值,替换的值,被替换的内容);

例:function htmtocode($content) {
$content = str_replace("\n", "<br>", str_replace(" ", "&nbsp;", $content));
return $content;
}

2、htmlspecialchars 格式化html

主要功能是将HTML格式化,防止在输出html时被浏览器执行


htmlspecialchars(所要格式化对象,定义单双引号,编码)






页: [1]
查看完整版本: php里的函数