nginx和apache的header写反了, 这里header后面要写相对地址,不能用绝对地址.

pull/372/head
pch18 2019-07-30 12:13:34 +09:00 committed by GitHub
parent c25eeab991
commit bdcae66485
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 8 deletions

View File

@ -1041,14 +1041,19 @@ function file_put_out($file,$download=-1,$downFilename=false){
//调用webserver下载
$server = strtolower($_SERVER['SERVER_SOFTWARE']);
if($server && $GLOBALS['config']['settings']['httpSendFile']){
if(strstr($server,'nginx')){//nginx
header("X-Sendfile: ".$file);
}else if(strstr($server,'apache')){ //apache
header('X-Accel-Redirect: '.$file);
}else if(strstr($server,'http')){//light http
header( "X-LIGHTTPD-send-file: " . $file);
if(substr($file, 0, strlen(DATA_PATH)) == DATA_PATH){
$relativePath = substr($file,strlen(dirname(DATA_PATH)));
if(strstr($server,'nginx')){//nginx
header('X-Accel-Redirect:'.$relativePath);
return;
}else if(strstr($server,'apache')){ //apache
header('X-Sendfile:'.$relativePath);
return;
}else if(strstr($server,'http')){//light http
header( "X-LIGHTTPD-send-file: " . $relativePath);
return;
}
}
return;
}
//远程路径不支持断点续传打开zip内部文件