Heim  >  Artikel  >  Backend-Entwicklung  >  PHP资源管理框架Assetic简介_PHP教程

PHP资源管理框架Assetic简介_PHP教程

WBOY
WBOYOriginal
2016-07-13 10:28:23908Durchsuche

Assetic是一个PHP的资源管理框架,用于合并和压缩 CSS/JS 资源。

示例代码如下:

复制代码 代码如下:
use Assetic\Asset\AssetCollection;
use Assetic\Asset\FileAsset;
use Assetic\Asset\GlobAsset;
$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请求。

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/788641.htmlTechArticleAssetic是一个PHP的资源管理框架,用于合并和压缩 CSS/JS 资源。 示例代码如下: 复制代码 代码如下: ?php use Assetic\Asset\AssetCollection; use Asseti...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn