在config/app.php 增加

html_compress => true/false

在vendor\topthink\think-template\src\Template.php大概在260行位置增加


if(!empty(config(‘app.html_compress’))&&config(‘app.html_compress’)){
                $content = ltrim(rtrim(preg_replace(array(“/> *([^ ]*) *</”, “//”, “‘/\*[^*]*\*/'”, “/\r\n/”, “/\n/”, “/\t/”, ‘/>[ ]+</’), array(“>\\1<“, ”, ”, ”, ”, ”, ‘><‘), $content)));
            }

效果

 

说点什么
支持Markdown语法
在"TP6压缩HTML/视图"已有2条评论
Loading...