我无法下载 excel 文件,它会下载文件但它没有内容并且它的大小是 0kb。这是我的html代码。
<h5 style="color: red;">
<a href="2.php?file=files/Battle_Entry_form.xls" class="links">
Click here to download A Registration form
</a>
</h5> <br />
2.php(这是我下载excel文件的php代码)
<?php
if(isset($_GET['file'])){
$filename = $_GET['file'];
header('Content-type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename="'.$filename.'"');
readfile("http://www.caledtech.com/batllewebsite/".$filename);
exit;
}
?>
我的代码中是否缺少某些内容?