strPath = Server.MapPath("/html/ddd/1.html")

解决方案 »

  1.   

    function MapPath($url)
    {
    $info=apache_lookup_uri($url);
    return $info->filename;
    }echo MapPath("/html/ddd/1.html");
      

  2.   

    apache_lookup_uri 在不是 apache 环境下能用吗?
      

  3.   

    注意php必须是以模块方式安装的才能使用此函数
      

  4.   

    我用 Windows 系统好象不行。有没有别的方法?通用地点的。
      

  5.   

    iis我不太清楚。你自己试试iis的函数吧
    iis_get_script_map这个看起来象
      

  6.   

    这种转换本来就是跟平台息息相关的事。没有通用的办法。如果你能确定你的网站没有使用虚拟目录的话,还可以这样得到真实路径:
    $_SERVER["DOCUMENT_ROOT"].$url;
      

  7.   

    看来是因为我误人子弟,被csdn踢了……重启了ie才能进了— —b
      

  8.   

    realpath() 可以吗?我试试。我一直以为 realpath 是处理 像 c:/12/154/../www 这样的结构时才用的。
      

  9.   

    好象 realpath 不行喔,我这样试的
    echo( realpath('/download'));我回家再试试。
      

  10.   

    west263 的空间很怪。好象一定要用 ftp 操作的才能更新缓存似的。
      

  11.   

    dirname()
    __FILE__
    这两个或许能帮到你什么。
      

  12.   

    function get_img_path($img_path)
    {//把../edit/uploadfile/这样的路径转化为相对于根目录的路径
    return "admin/".substr($img_path,3);

    }
      

  13.   

    如果你能确定你的网站没有使用虚拟目录的话,还可以这样得到真实路径:
    $_SERVER["DOCUMENT_ROOT"].$url;---------------
    这个方法或许不错。多谢了哈。