只需看看Ask.com主页源。这是一条很长的线。
如何从最终的 html 输出中删除换行符和其他不必要的代码?(Views
内容)
例如:
<div id="test">
<span>Hello World!</span>
</div>
至:
<div id="test"><span>Hello World!</span></div>
GZip可以做到吗?
I haven't had time to implement this myself yet however this helper looks good.
https://github.com/plyst/cakephp-minifyhtml-plugin
You can also use the following to minify the rest of your assets
您可以在这篇面包店文章中使用助手:http: //bakery.cakephp.org/articles/tiutalk/2010/07/09/output-valid-and-clean-x-html-with-tidyhelper
要将所有内容集中在一条线上,您可以替换
return $output;
和
return preg_replace('/\r?\n/m', '', $output);