2011-01-02 16 views
0

私は、このドキュメントを使用して縮小化で働いていた:縮小化 - PHP - 縮小化::サーブ - HTTP/1.0 400不正な要求

http://code.google.com/p/minify/wiki/CustomServer

をし、私は解決できない問題があります。

'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), 

I:

<?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 



?> 

私が試しましたまた、これらのファイルを異なる場所に配置しても、肯定的な結果は得られません。 質問です:何が起こっているのですか?なぜHTTPリクエストがそこにあるのですか?配列から

答えて

1

削除$のsrc変数:あなたは、HTMLファイルにスクリプトへのリンクを挿入する必要があるため

<?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要求がある:

<script type="text/javascript" src="/js/script.js.php" ></script> 

含まれているファイルの1つがサーバは404応答を送信する必要があります(見つからない)

+0

thnx多くのAnatoly! – Erroid

関連する問題