$fileurl=$DOCUMENT_ROOT.$filename;
allright

解决方案 »

  1.   

    $url = 'http://'.getenv('HTTP_HOST').getenv('REQUEST_URI');
      

  2.   


     如果你能仔细看看 phpinfo() 的话就不用花这 10 分了 $_SERVER["REQUEST_URI"] 这个是 4.1 以后才能用的……
     
      

  3.   

    没试过3.几版本的php,应该也行,因为这是环境变量,不过估计不能用$_SERVER['...'],应该用getenv().
      

  4.   

    来看看chinaren是怎么用JS实现的吧function UrlConv(url)
    {
          if(url.href.indexOf("backdoor.jsp")>0)
                    url="http://www.chinaren.com";
          url = url + "";
          var m_url = url;
          var outstring = "";
          var x1 = 0;
          for(x1 = 0 ; x1 < (m_url.length) ; x1++)
          {
            chr = m_url.substr(x1,1);
            if(chr=='&')
            {
              outstring += "%26";
              continue;
            }
            if(chr=='?')
            {
              outstring += "%3F";
              continue;
            }
            if(chr==':')
            {
              outstring += "%3A";
              continue;
            }
            outstring += chr;
          }
          return outstring;
    }
    function login(){
          top.document.location = "http://profile.chinaren.com/zhs/login.jsp?group=alumni&url="+UrlConv(top.window.location);
    }function logout(){
       top.document.location = "http://profile.chinaren.com/zhs/backdoor.jsp?group=alumni&url="+UrlConv(top.window.location);
    }function register(){
      top.document.location = "http://profile.chinaren.com/zhs/register.jsp?group=alumni&url="+UrlConv(top.window.location);}