我用apache架设的服务器            在网盘里下载  文件 用如下代码 
header("Content-type: application/$kind");
      
header("Content-Disposition: attachment; filename=$filename");
   
readfile($requireurl);
//$requireurl=http://59.64.194.138/websvnWin/filedetails.php?repname=lvyang&path=%2Fpicture%2FDesert.jpg我确定 直接 在浏览器下 输入 以上 链接  图片 会显示 出来
但是 readfile却  失败 请问 可能出现的问题和解决 方法//http://59.64.194.138/websvnWin/dl.php?repname=lvyang&path=%2Fpicture%2FDesert.jpg&rev=447&peg=447
用这个链接  却能直接下载?  求分析 而 以上链接 当文件是个 中文名 例如 “dl灯 楼.jpg"却下载失败 http://59.64.194.138/websvnWin/dl.php?repname=lvyang&path=%2Fpicture%2Fdl%E7%81%AF%E6%A5%BC.jpg&rev=447&peg=447

解决方案 »

  1.   


    header("content-type: application/octet-stream");
    header("accept-ranges: bytes");
    header("accept-length: " . filesize($fileDir . $fileName));
    header("content-disposition: attachment; filename=" . $fileName);
      

  2.   

    运行时配置这些函数的行为受 php.ini 中的设置影响。文件系统和流配置选项
    名称 默认值 可修改范围 更新记录
    allow_url_fopen "1" PHP_INI_SYSTEM 在 PHP <= 4.3.4 时是 PHP_INI_ALL。PHP 4.0.4 版以后可用。
    user_agent NULL PHP_INI_ALL PHP 4.3.0 版以后可用。
    default_socket_timeout "60" PHP_INI_ALL PHP 4.3.0 版以后可用。
    from "" PHP_INI_ALL  
    auto_detect_line_endings "0" PHP_INI_ALL PHP 4.3.0 版以后可用。
    这是配置指令的简短说明。allow_url_fopen boolean
    本选项激活了 URL 形式的 fopen 封装协议使得可以访问 URL 对象例如文件。默认的封装协议提供用 ftp 和 http 协议来访问远程文件,一些扩展库例如 zlib 可能会注册更多的封装协议。Note:出于安全性考虑,此选项只能在 php.ini 中设置。Note:此选项是紧接着版本 4.0.3 发布后引进的。版本 4.0.3 以及之前的版本只能在编译时通过配置项 --disable-url-fopen-wrapper 来取消此特性。Warning
    Windows 版在 PHP 4.3.0 之前,以下函数不支持远程文件访问:include(),include_once(), require(),require_once() 和GD and Image 函数中的 imagecreatefromXXX 函数。