标签:
// 压缩html function compress_html($string) { $string = str_replace("\r\n", ‘‘, $string); $string = str_replace("\n", ‘‘, $string); $string = str_replace("\t", ‘‘, $string); $pattern = array("/> *([^ ]*) *</", "/[\s]+/", "/<!--[\\w\\W\r\\n]*?-->/", "/\" /", "/ \"/", "‘/\*[^*]*\*/‘"); $replace = array(">\\1<", " ", "", "\"", "\"", ""); return preg_replace($pattern, $replace, $string); }
好用不解释
标签:
原文地址:http://www.cnblogs.com/smismile/p/5183726.html