switch ($extension){
case "jpg":
case "jpeg": $ctype="image/jpeg"break
case "pdf": $ctype="application/磨森pdf"break
case "gif": $ctype="image/gif"break
case "png": $ctype="image/png"break
case "doc": $ctype="application/msword"break
case "zip": $ctype="application/zip"break
case "春游帆rar": $ctype="application/扒雹rar" break
default: $ctype="application/force-download"
}
header("Pragma: public")
header("Expires: 0")
header("Cache-Control: must-revalidate, post-check=0, pre-check=0")
header("Cache-Control: private",false)
header("Content-type: ". 这里是类型)
header("Content-Transfer-Encoding: binary")
header("Content-Length: ". filesize($path))
header('Content-Disposition: attachmentfilename="100.jpg" ')
readfile($path)
-----------------------------------------
你仔细看一下代码,然后就可以用了。。。
《PHP程序设计经典300例》百度网盘pdf最新全集下载:
链接:https://pan.baidu.com/s/1rpjBoUpgfEj27M_z0Vk74A
?pwd=rgq1 提取码:rgq1简介:PHP是当今使用最为广泛的服务器脚本语言,本书的架构基于PHP+Web 2.0,涵盖了页面动态特效展示、服务器页面渲染到数据库应用等所有主流应用,读者通读此书后即可实现简单的Web前端入门实践。
写的比较简单,大概思路就是颂州这样喊橘,你自己再改改就ok了a.php
<?php
rename("C:/my/path/file.txt","C:/my/path/file.doc")
?>
<a href="b.php">下载</a>
b.php
<?php
$file = "C:/my/path/file.doc"
header("Content-Disposition: attachmentfilename=file.doc"郑樱团)
header('Content-Transfer-Encoding: binary')
header("Content-Description: File Transfer")
header("Cache-Control: must-revalidate, post-check=0, pre-check=0")
header("Cache-Control: public")
header("Content-Type: $ctype")
header("Content-Length:".filesize($file))
flush()
readfile($file)
?>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)