连接到txt文本的超链接,不直接打开而是点击后下载的处理方法 |
本文标签:txt,直接下载 服务器端两种处理方法,一个是apache或者iis or tomcat等服务器中进行设置,或者在程序中指定发送类型 。 该信息属于http头部信息,php有直接进行头部信息操作的函数 。 php的实现方法: 复制代码 代码如下: <?php header("Content-Type: application/force-download"); header("Content-Disposition: attachment; filename=".basename($_GET[url])); readfile($filename); ?> |