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 怎样才能让鼠标沿着线条的中心线轨迹移动
  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?
  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?