我工作的一種方法,通過PHP和後一些幫助的形式如此大量的服務了MP3文件設置Apache服務PHP,我得到了它的工作here當請求MP3文件
然而,例如沒有出現,當我在音頻標籤使用它作爲源這樣
<html>
<head>
<title>Audio Tag Experiment</title>
</head>
<body>
<audio id='audio-element' src="music/mp3.php" autoplay controls>
Your browser does not support the audio element.
</audio>
</body>
</html>
工作,這裏的PHP
<?php
$track = "lilly.mp3";
if(file_exists($track))
{
header("Content-Transfer-Encoding: binary");
header("Content-Type: audio/mpeg, audio/x-mpeg, audio/x-mpeg-3, audio/mpeg3");
header('Content-length: ' . filesize($track));
header('Content-Disposition: filename="lilly.mp3"');
header('X-Pad: avoid browser bug');
Header('Cache-Control: no-cache');
readfile($track);
}else{
echo "no file";
}
所以我想(這可能是AR你告訴我),我可能會設置Apache來在有人請求.MP3時爲PHP文件提供服務。
所以我三個問題
- 將這項工作
- 好主意/壞主意?
- 我需要做什麼?將「AddType應用程序/ x-httpd-php .mp3」int他httpd conf做到這一點?
天才!內聯做了訣竅,我已經整理了Content-Type,現在我正在發送一個404。 – gargantuan 2009-10-04 16:39:38