【发布时间】:2012-10-19 05:21:45
【问题描述】:
每当有一个名称为 space 的 CSV 文件(如 xyz abc.csv)时,我们都会面临通过 PHP 代码下载的问题,而其他类似的 CSV 文件中没有空间,可以正常工作并正常下载。
下面是我的下载代码:
$file_path = 'http://www.servername.com/subfolder/subfolder/';
$file = urlencode('Today new_18-10-2012_21-13-21.csv');
header('Content-Type: application/csv');
header('Content-Disposition: attachment; filename="'.$file.'"');
header('Pragma: no-cache');
readfile($file_path.$file);
当文件被下载时,它总是0 bytes,而原始文件的大小是93kb
对此问题的任何建议。
提前致谢!
【问题讨论】: