示例代码如下:
复制代码 代码如下:
<?php
use asseticassetassetcollection;
use asseticassetfileasset;
use asseticassetglobasset;
$js = new assetcollection(array(
new globasset('/path/to/js/*'),
new fileasset('/path/to/another.js'),
));
// the code is merged when the asset is dumped
echo $js->dump();
use asseticassetassetcollection;
use asseticassetfileasset;
use asseticassetglobasset;
$js = new assetcollection(array(
new globasset('/path/to/js/*'),
new fileasset('/path/to/another.js'),
));
// the code is merged when the asset is dumped
echo $js->dump();
采用这种方式合并资源可以减少浏览器对资源的请求数、降低资源下载大小、加速站点运行速度。也消除了大量不必要的http请求。
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!