readfile()无法下载文件并显示二进制文本。 这是我的代码
$ fileName = $ data [“ P0”];
$filePath = FileStorage::getFilesDir().'IsoFile/'.$fileName;
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.basename($filePath).'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($filePath));
flush(); // Flush system output buffer
readfile($filePath);
filepath是显示服务器文件路径,例如:/home/www/mansoor/open3A/specifics/IsoFile/test.pdf
但在文本下方显示