php – 如何弹出下载提示?
发布时间:2020-12-13 22:01:27 所属栏目:PHP教程 来源:网络整理
导读:我用它来将内容放到一个文件中 file_put_contents('abc.txt',$text); 在此之后我需要弹出一个用户来保存/下载文件 我该怎么做 解决方法 这将为用户提供下载提示: ?php header('Content-type: text/plain'); // What file will be named after downloading h
我用它来将内容放到一个文件中
file_put_contents('abc.txt',$text); 在此之后我需要弹出一个用户来保存/下载文件 解决方法
这将为用户提供下载提示:
<?php header('Content-type: text/plain'); // What file will be named after downloading header('Content-Disposition: attachment; filename="abc.txt"'); // File to download readfile('abc.txt'); ?> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |