dream789 发表于 2017-4-4 14:24:09

PHP通过Header()函数实现文件下载的代码

以下代码通过使用php header函数实现文件的下载。
    <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>应用header()函数实现下载 - www.jbxue.com</title>
<style type="text/css">
<!--
body {
margin-left: 00px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
.style1 {font-size: 12px}
-->
</style></head>
<body>
<table width="385" height="185" border="0" cellpadding="0" cellspacing="0">
<form name="form1" method="post" action="index_ok.php">
<tr>
<td width="55" height="85"> </td>
<td width="275"> </td>
<td width="55"> </td>
</tr>
<tr>
<td height="30"> </td>
<td align="center"><input type="submit" name="Submit" value="同意">
<input type="reset" name="Submit2" value="不同意"></td>
<td> </td>
</tr>
<tr>
<td height="30"> </td>
<td> </td>
<td> </td>
</tr>
</form>
</table>
</body>
</html>

index_ok.php:
    <?php session_start();
if($Submit=="同意"){
header("location:http://www.xxxxx.com/templets/default/images/logo1.gif");}
?>
页: [1]
查看完整版本: PHP通过Header()函数实现文件下载的代码