php ziparc 扩展_php header 下载zip文件的问题

是一个动态php文件我把phpheader代码写进去但是打开这个动态页面的时候能获取到文件路径并且把这个文件.zip依html方式的打开了全是乱码请问怎么才能使打开这个页面弹出点击弹出下载而...

是一个动态php文件 我把php header 代码写进去 但是打开这个动态页面的时候能获取到文件路径 并且把这个文件.zip依html方式的打开了 全是乱码

请问怎么才能使打开这个页面 弹出点击弹出下载 而不是把这个.zip文件依html方式打开

error_reporting(0);

$referer = $_SERVER['HTTP_REFERER'];

$selfurl = $_SERVER['HTTP_HOST'];

/*

if(false == strpos($referer,$selfurl))

{

die(" Request Error.! ");

exit(1);

}

*/

require_once(dirname(__FILE__)."/../include/common.inc.php");

require_once(DEDEINC.'/download.class.php');

$t1 = ExecTime();

if(empty($okview))

{

$okview = '';

}

if(isset($arcID))

{

$aid = $arcID;

}

$arc = new Archives($aid);

if($arc->IsError)

{

ParamError();

}

$arc->Display();

if(isset($arcID))

{

$aid = $arcID;

}

$arcID = $aid = (isset($aid) && is_numeric($aid)) ? $aid : 0;

if($aid==0)

{

die(" Request Error! ");

}

$row = $dsql->GetOne("Select * From `#@__icons` where aid='$aid' ");

$str = $row['icodown'];

if(substr_count($str,"/uploads/soft/")>0){

$file = ltrim($str,"/uploads/soft/");

$link = "<?php echo $cfg_basehost; ?>";

$url = "".$link."".$file."";

//echo "$url";

$get_url = urldecode($url);

$file_name = basename($get_url);

$get_url = "../uploads/soft/" . $file;

ob_end_clean();

header("Content-Type: application/force-download");

header("Content-Transfer-Encoding: binary");

header('Content-Type: application/zip');

header('Content-Disposition: attachment; filename='.'123_'.$file_name);

header('Content-Length: '.filesize($get_url));

error_reporting(0);

readfile($get_url);

flush();

ob_flush();

exit;

}else{

$get_url = urldecode($str);

$file_name = basename($get_url);

header("Content-Type: application/force-download");

header("Content-Transfer-Encoding: binary");

header('Content-Type: application/zip');

header('Content-Disposition: attachment; filename='.'123_'.$file_name);

header("Connection: close");

readfile($get_url);

}

exit;

?>

为什么不弹出下载 而是直接把这个zip的内容打印出来了

展开

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值