您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 日喀则分类信息网,免费分类信息发布

php服务器 提示下载功能解决思路

2024/6/6 14:23:10发布25次查看
php服务器 提示下载功能
我这里是pc端做服务器,现在别的电脑访问我这里,需要提示下载功能,怎么实现呢?
好像是在index.php里写下载吧?完全没这方面的经验,不知道该怎么做。
我加了这一段
php code
然后该怎么做呢?
------解决方案--------------------
然后在别的电脑上访问这个页面呀
------解决方案--------------------
直接用html代码做个链接不行吗?
------解决方案--------------------
filename=aa.rar //这里要取个名字。不然会形成rar 文件。
------解决方案--------------------
php code#down.php$file = 'asdfggg.pdf';_download(files_dir/.$file, $file);function _download($f_location,$f_name){ header (cache-control: must-revalidate, post-check=0, pre-check=0); header('content-description: file transfer'); header('content-type: application/octet-stream'); header('content-length: ' . filesize($f_location)); header('content-disposition: attachment; filename=' . basename($f_name)); readfile($f_location); }
------解决方案--------------------

探讨
我在localsettings.php上加了这3行代码:
php code
header(content-type:application/rar);
header(content-disposition:attachment;filename=sqlite.rar);
readfile(e:\ziptest\sqlite.rar);
登录首页的时候,有下载提示,但是……
日喀则分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录