我的错误日志的失控与两个以下错误
warning feof() expects parameter 1 to be resource
和
warning fread() expects parameter 1 to be resource
负责代码位
<?php
$file = '../upload/files/' . $filex;
header("Content-Disposition: attachment; filename=" . urlencode($file));
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
header("Content-Description: File Transfer");
header("Content-Length: " . filesize($file));
flush(); // this doesn't really matter.
$fp = fopen($file, "r");
while (!feof($fp)) {
echo fread($fp, 65536);
flush(); // this is essential for large downloads
}
fclose($fp);
?>
我现在用头下载,但它吓坏了这段代码 - 之前有人问我什么都试过,我试过谷歌,但仍不能完全理解的错误消息。