0
你好需要下载生成的csv文件,我使用下面的代码,但在服务器上我无法下载csv文件。相同的代码在我的本地系统中工作正常,但不能在活动服务器上工作。下载csv文件不能在服务器上工作
<?php
function downloadFile($filename,$filepath)
{
header("Content-type: text/csv"); // instead of pdf use others... for text
header("Content-disposition: attachment; filename=".$filename);
readfile($filepath);
}
?>
当你调用函数时,输出是什么?任何错误消息?你确定'$ filepath'指向一个现有的文件吗?确保你有读权限 – Teneff
是文件路径是存在的文件。 – Kishan
我的文件有0644权限 – Kishan