Php 从其他服务器下载文件返回空文件
我正在使用此脚本从其他服务器下载音频文件Php 从其他服务器下载文件返回空文件,php,Php,我正在使用此脚本从其他服务器下载音频文件 if(check_url($url)) { if(ini_get('zlib.output_compression')) { ini_set('zlib.output_compression', 'Off'); } header('Content-Description: File Transfer'); header('Content-Type: audio/mpeg'); header('Co
if(check_url($url)) {
if(ini_get('zlib.output_compression')) {
ini_set('zlib.output_compression', 'Off');
}
header('Content-Description: File Transfer');
header('Content-Type: audio/mpeg');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($url));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
readfile($url);
die();
}
其中,$url
是文件url
在我的流浪机器上,脚本运行良好。但在服务器上,下载的文件有0b。文件是否存在?用@JimWright-Yes检查路径。我选中了。@ccKep那么,我怎样才能对自动下载的文件进行修改呢?
readfile
的返回值是多少?是不是错误
?(请注意,这不同于0
)