当前位置: 首页>>代码示例>>PHP>>正文


PHP F3::minify方法代码示例

本文整理汇总了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/&amp;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/&amp;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')));
开发者ID:seyyah,项目名称:f3kayOLD,代码行数:30,代码来源:minified.php


注:本文中的F3::minify方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。