0

这真让我抓狂。这似乎是一个简单的错误——我看过几十篇关于他们的脚本的帖子比我的要复杂得多。

我有一个 php 脚本,它应该通过设置标题来强制下载。我已将脚本精简为:

<?php
header("Content-Type: audio/mp3");
header("Content-Disposition: attachment; filename=\"audio.mp3\";" );
readfile("audio.mp3");
exit();
?>

为什么我的标头会被发送出去?我尝试了 obj_start 和 obj_flush,但到目前为止还没有运气。这可能是我的主机的问题吗?我正在使用 1and1.com

4

1 回答 1

2

您的脚本在测试时运行良好——确保脚本的开头或结尾没有任何空格。

于 2012-04-17T06:21:09.527 回答