您好,欢迎访问一九零五行业门户网

PHP html标签正则替换并可自定义正则规则

<?php function pregstring($str){ $strtemp = trim($str); $search = array( "|'|uis", "|<script[^>].*?</script>|uis", // 去掉 javascript "|\[字定义\].*\[/字定义\]|uis", // 去掉缩略图 "|<[\/\!].*?[^<>]*?>|uis", // 去掉 html 标记 "'>(quot|#34);'i", // 替换 html 实体 "'>(amp|#38);'i", "|,|uis", "|[\s]{2,}|is", "[>nbsp;]isu", "|[$]|uis", ); $replace = array( "`", "", "", "", "", "", "", " ", " ", " ", ); $text = preg_replace($search, $replace, $strtemp); return $text; } echo pregstring(字符串); //使用方法 ?>
更多php html标签正则替换并可自定义正则规则。
其它类似信息

推荐信息