minify - PHP - Minify :: serve - HTTP / 1.0 400 Bad Request [英] minify - PHP - Minify::serve - HTTP/1.0 400 Bad Request
本文介绍了minify - PHP - Minify :: serve - HTTP / 1.0 400 Bad Request的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用此文档使用 minify :
http://code.google.com/p/minify/wiki/CustomServer
和我有问题,我无法解决:
and I have problem that I can't resolve:
<?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请求?
I also put those files in diffrent places without positive result. Question is: what's going on? and why HTTP Request is there?
推荐答案
从数组中删除$ src变量:
Remove $src variable from an array:
<?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
因为你应该插入HTTP请求将您的脚本链接到html文件:
HTTP Request is there because you should insert a link to your script into html-file:
<script type="text/javascript" src="/js/script.js.php" ></script>
如果其中一个包含的文件不存在,服务器必须发送404响应(未找到)
If one of the included file will be not exists, server must send 404-response (NOT FOUND)
这篇关于minify - PHP - Minify :: serve - HTTP / 1.0 400 Bad Request的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文