我使用这个文档来处理minify:
http://code.google.com/p/minify/wiki/CustomServer
我有一个我无法解决的问题
<?php
set_include_path('/srv/home/xyz/public_html/COMPONENTS/_php/minify/min/lib' .
PATH_SEPARATOR . get_include_path());
require 'Minify.php';
require 'Minify/Cache/File.php';
Minify::setCache(new Minify_Cache_File());
//no error - everything is ok... until now
$options = array(
'files' => array('/srv/home/xyz/public_html/test1.js',
'/srv/home/xyz/public_html/test2.js', $src),
'maxAge' => 86400
);
Minify::serve('Files', $options);
//--> HTTP/1.0 400 Bad Request
?>我试过:
'files' => array('test1.js', 'test2.js', $src),
'files' => array('//test1.js', '//test2.js', $src),
'files' => array('/srv/home/xyz/public_html/test1.js',
'/srv/home/xyz/public_html/test2.js', $src),我也把这些文件放在不同的地方,没有积极的结果。问题是:这是怎么回事?为什么会有HTTP请求?
发布于 2011-01-02 17:58:43
从数组中删除$src变量:
<?php
$options = array(
'files' => array('/srv/home/xyz/public_html/test1.js',
'/srv/home/xyz/public_html/test2.js'),
'maxAge' => 86400
);
?>
array('/srv/home/xyz/public_html/test1.js') // this path is absolute physical path
array('//test1.js') // this path is a relative path from document root of the web-server因为应该将指向脚本的链接插入html-file中,所以存在HTTP请求:
<script type="text/javascript" src="/js/script.js.php" ></script>如果其中一个文件不存在,服务器必须发送404-响应(未找到)。
https://stackoverflow.com/questions/4579412
复制相似问题