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


PHP Minify::browserCache方法代码示例

本文整理汇总了PHP中Minify::browserCache方法的典型用法代码示例。如果您正苦于以下问题:PHP Minify::browserCache方法的具体用法?PHP Minify::browserCache怎么用?PHP Minify::browserCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Minify的用法示例。


在下文中一共展示了Minify::browserCache方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handleRequest

 /**
  * Combines, minifies, and outputs the requested files.
  *
  * Inspects the $_GET array for a 'files' entry containing a comma-separated
  * list and uses this as the set of files to be combined and minified.
  */
 public static function handleRequest()
 {
     // 404 if no files were requested.
     if (!isset($_GET['files'])) {
         header('HTTP/1.0 404 Not Found');
         exit;
     }
     $files = array_map('trim', explode(',', $_GET['files'], MINIFY_MAX_FILES));
     // 404 if the $files array is empty for some weird reason.
     if (!count($files)) {
         header('HTTP/1.0 404 Not Found');
         exit;
     }
     // Determine the content type based on the extension of the first file
     // requested.
     $type = preg_match('/\\.js$/iD', $files[0]) ? self::TYPE_JS : self::TYPE_CSS;
     // Minify and spit out the result.
     try {
         $minify = new Minify($type, $files);
         header("Content-Type: {$type};charset=" . MINIFY_ENCODING);
         $minify->browserCache();
         echo $minify->combine();
         exit;
     } catch (MinifyException $e) {
         header('HTTP/1.0 404 Not Found');
         echo htmlentities($e->getMessage());
         exit;
     }
 }
开发者ID:nrajput,项目名称:widgetJs,代码行数:35,代码来源:minify.php

示例2: handleRequest

 /**
  * Combines, minifies, and outputs the requested files.
  *
  * Inspects the $_GET array for a 'files' entry containing a comma-separated
  * list and uses this as the set of files to be combined and minified.
  */
 function handleRequest()
 {
     // 404 if no files were requested.
     if (!isset($_GET['files'])) {
         header('HTTP/1.0 404 Not Found');
         exit;
     }
     $files = array_map('trim', explode(',', $_GET['files'], MINIFY_MAX_FILES));
     // 404 if the $files array is empty for some weird reason.
     if (!count($files)) {
         header('HTTP/1.0 404 Not Found');
         exit;
     }
     // Determine the content type based on the extension of the first file
     // requested.
     $type = preg_match('/\\.js$/iD', $files[0]) ? TYPE_JS : TYPE_CSS;
     // Minify and spit out the result.
     $minify = new Minify($type);
     $minify->addFile($files);
     ob_start("ob_gzhandler");
     header("Content-Type: {$type};charset=" . MINIFY_ENCODING);
     $minify->browserCache();
     echo $minify->combine();
 }
开发者ID:preinboth,项目名称:formidable,代码行数:30,代码来源:minify.php


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