该脚本不断返回“else”响应。为什么我的情况总是失败:
<?php
$fileName = $_GET['far_sighted_michael_pitluk.mp3'];
$fileDisplayName = "Far-Sighted";
// Fetch the file info.
$filePath = 'http://michaelpitluk.com/audio/far_sighted_michael_pitluk.mp3';
if(file_exists($filePath)) {
$fileName = basename($filePath);
$fileSize = filesize($filePath);
// Output headers.
header("Cache-Control: private");
header("Content-Type: application/stream");
header("Content-Length: ".$fileSize);
header("Content-Disposition: attachment; filename=".$fileDisplayName);
// Output file.
readfile ($filePath);
exit();
}
else {
die('The provided file path is not valid.');
}
?>
我不明白路径有什么问题。