"http://$_SERVER["HTTP_HOST"]/_SERVER["SCRIPT_NAME"]"

解决方案 »

  1.   

    你的意思是指包括?后的参数吗?$REQUEST_URI
    $_ENV["REQUEST_URI"]
    _SERVER["REQUEST_URI"]
      

  2.   

    darkwing能解释一下吗,本人没学过php
    非常感谢
      

  3.   

    把window.location作为参数传给服务器就可以了。
    问题是你要的是用户键入的什么地址呢?键入的地址不就是访问到你的PHP文件么?
      

  4.   

    我写的是按cgi模式的。
    web 服务器通过cgi(不是指perl)与cgi程序通信,
    除了get和post方法的数据,其他重要数据都是通过环境变量传递的。
    php中预设数组$_SERVER来访问环境变量。
    url没有直接数据,就通过字符串运算得到。 ^^
    php中有哪些环境变量,可以通过执行包含phpinfo()函数的php脚本
    列出,同时还有许多其它重要信息。
      

  5.   

    to skimeister(我是奋怒) :
    $REQUEST_URI 好像不行,少了很多信息。我把我的想法弄成文件如下:
    geturl.php:
    <html><head><title></title></head>
    <body>
    <?
      if(!isset($fullurl))
      {
    ?>
    <form name="url" action="<? echo($PHP_SELF); ?>" method="post">
      <input name="fullurl" type="hidden">
    </form>
    <script langugage="JavaScript">
      url.fullurl.value=window.location.toString();
      url.submit();
    </script>
    <?
      }
      else
      {
        echo("Your input url is ".$fullurl."<br>");
        //you can put whatever other HTML elements below.
    ?><?
      }
    ?>
    </body>
    </html>浏览器输入:
    http://192.168.0.1/geturl.php?sdkf&dfkaj输出:
    Your input url is http://192.168.0.1/geturl.php?sdkf&dfkaj