PHP自动缩小。有没有? [英] PHP auto minify. Is there any?
本文介绍了PHP自动缩小。有没有?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用PHP Minify,它是伟大的。但我的问题,有什么PHP插件或东西,它会自动检测javascript / CSS代码并自动缩小它?谢谢。
I use PHP Minify and it's great. But my question, is there any PHP plugin or something, which would automatically detect javascript/css code and minify it automatically? Thank you.
推荐答案
Javascript minifier?
Javascript minifier?
a href =http://www.electrictoolbox.com/combine-minify-javascript-php/ =nofollow>此处
Take a look here
require_once('jsmin-1.1.1.php');
$files = glob("/path/to/js/merge/*.js");
$js = "";
foreach($files as $file) {
$js .= JSMin::minify(file_get_contents($file));
}
file_put_contents("/path/to/js/combined.js", $js);
// or to output it: echo $js;
这篇关于PHP自动缩小。有没有?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文