本文整理汇总了PHP中F3::minify方法的典型用法代码示例。如果您正苦于以下问题:PHP F3::minify方法的具体用法?PHP F3::minify怎么用?PHP F3::minify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类F3
的用法示例。
在下文中一共展示了F3::minify方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: files
<?php
/**
We can expect the link specified in layout.htm to be routed here:-
<link rel="stylesheet" type="text/css"
href="/min?base=gui/css/&files=demo.css"/>
Notice that we only specified the following in our router/controller:-
F3::route('GET /min',':minified');
The F3::minify method combines all our comma-separated files (although
we just have demo.css in our example) and strips them of all whitespaces
and comments. The output is then gzipped and given a far-future expiry
date so we get the squeeze every ounce of performance from our server.
We could have done the same with Javascript files. The pattern should be
the same. Here's an example:-
<script type="text/javascript"
src="/min?base=gui/js/&files=mootools-core.js,mylib.js">
</script>
You can name the variables 'base' and 'files' any way you like. But make
sure that the path pointed to by 'base' (or whatever variable you replace
it with is relative to your Web root's index.php.
You may want to do some validation here before using the REQUEST variable
directly in your application. Otherwise, you'd be vulnerable to XSS
attacks.
**/
F3::minify(F3::get('REQUEST.base'), explode(',', F3::get('REQUEST.files')));