【发布时间】:2010-10-13 18:47:37
【问题描述】:
你好 好吧,这就是交易 我的服务器上有我的 mp3 文件,每个文件都在自己的文件夹中。 在该文件夹中是 mp3 和一个带有以下脚本的 php 文件:
<?php
// We'll be outputting a PDF
header('Content-type: audio/mp3');
// It will be called file.mp3
header('Content-Disposition: attachment; filename="mysong.mp3"');
// The PDF source is in original.mp3
readfile("mysong.mp3");
?>
问题是,当我点击去那个 php 页面时,标题应该是这样的,以便它自动下载 mp3 文件,但当它下载时它会下载一个 300KB 的文件,但是当我转到 mp3 的实际链接时文件它在浏览器中完美播放,所以我猜测给出标题的 php 文件有问题。
【问题讨论】:
-
尝试了 PHP 手册中的示例? php.net/manual/en/function.readfile.php