Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/297.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从其他服务器下载文件返回空文件_Php - Fatal编程技术网

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