dongtingrun4973 2012-06-23 09:54
浏览 25
已采纳

PHP缩小子目录中的崩溃 - WAMP

I followed the PHP Minify instructions listed on this page to use a sub-directory, but it just returns a 400 bad request error at my test URL. Any ideas or leads on how to fix this?

Steps I followed

  1. Put min folder relative to my "demo-site's" root
  2. Added code snippet below as directed on the instructions page.
  3. Ran the URL test, returns a 400 bad request error.

More Info

Server: Wamp PHP v5.3

Location on server: var/www/demo-site

URL giving a 400 error: http://localhost/demo-site/min/f=min/quick-test.js

Code placed in config.php

// Set the document root to be the path of the "site root"
$min_documentRoot = substr(__FILE__, 0, -15);

// Set $sitePrefix to the path of the site from the webserver's real docroot
list($sitePrefix) = explode('/min/index.php', $_SERVER['SCRIPT_NAME'], 2);

// Prepend $sitePrefix to the rewritten URIs in CSS files
$min_symlinks['//' . ltrim($sitePrefix, '/')] = $min_documentRoot;
  • 写回答

1条回答 默认 最新

  • doukeyong3746487 2012-06-23 17:04
    关注

    In the version of Minify I'm using you have to find the following lines (shown in code sample below) with a search and replace them in config.php. Simply copying and pasting this code into config.php blows everything up. Which is unexpected since the documentation at the time of writing this pretty much says copy and paste the code snippet...

    // Search for...
    $min_documentRoot = '';
    // Replace with...
    $min_documentRoot = pathinfo(pathinfo(__FILE__, PATHINFO_DIRNAME), PATHINFO_DIRNAME);
    
    // Search for...
    $min_symlinks = array();
    // Replace with...
    list($sitePrefix) = explode('/min/index.php', $_SERVER['SCRIPT_NAME'], 2); 
    $min_symlinks['//' . ltrim($sitePrefix, '/')] = $min_documentRoot;
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料