thinkphp3.2.2版本去掉html页面中的空格配置不起效

浏览:2545 发布日期:2014/12/04
3.2.2 - 普通 - 未处理
thinkphp的配置
'TMPL_STRIP_SPACE' => true, // 是否去除模板文件里面的html空格与换行

经证明,这个配置不起效,
原因:ThinkPHP\Library\Think\Template.class.php 里面有个方法compiler(编译模板文件内容),相比3.1版本少了一段代码导致的:
if(C('TMPL_STRIP_SPACE')) {
/* 去除html空格与换行 */
$find = array('~>\s+<~','~>(\s+\n|\r)~');
$replace = array('><','>');
$tmplContent = preg_replace($find, $replace, $tmplContent);
}
评论(
后面还有条评论,点击查看>>