Home > Backend Development > PHP Tutorial > How to handle hyperlinks connected to txt text without opening them directly but downloading them after clicking_PHP Tutorial

How to handle hyperlinks connected to txt text without opening them directly but downloading them after clicking_PHP Tutorial

WBOY
Release: 2016-07-21 15:45:31
Original
1147 people have browsed it

There are two processing methods on the server side. One is to set it in a server such as apache or iis or tomcat, or to specify the sending type in the program.
This information belongs to http header information, and PHP has functions to directly operate on header information. Implementation method of
php:

Copy code The code is as follows:

header(" Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=".basename($_GET['url']));
readfile($filename);
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320324.htmlTechArticleTwo processing methods on the server side, one is to set it in a server such as apache or iis or tomcat, or in the program Specify the sending type. This information belongs to http header information, PHP has direct...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template