Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/272.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.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_Apache - Fatal编程技术网

Php 从具有安全连接的服务器下载文件时出现问题

Php 从具有安全连接的服务器下载文件时出现问题,php,apache,Php,Apache,你好 面临从服务器下载文件的问题。有这样一个代码 function getFile($file) { if (file_exists($file)) { if (ob_get_level()) { ob_end_clean(); } header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream');

你好

面临从服务器下载文件的问题。有这样一个代码

function getFile($file)    
{
if (file_exists($file))
{
    if (ob_get_level())
    {
        ob_end_clean();
    }

    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename=' . basename($file));
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . filesize($file));

    if ($fd = fopen($file, 'rb')) 
    {
        while (!feof($fd)) {
        print fread($fd, 1024);
    }
    fclose($fd);
    }
}  
}
在本地计算机上,apache都表现得很好,标准窗口打开/保存文件。但是在战地服务器配置的安全连接(如apache)上,什么也没有发生

在Apache配置文件设置中,将重定向到https。也许整个过程都是在https中,在Apache配置文件中添加一行AddType应用程序/octet流。Xyz它怎么能赢


提前谢谢

问题解决了。整个捕获对共享目录的文件具有权限