Home > Article > Backend Development > The happy life of an otaku in the ancient harem txt. The hyperlink connected to the txt text is not opened directly but downloaded after clicking.
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.
How to implement php:
Copy the code The code is as follows:
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=".basename($_GET['url']));
readfile($filename);
?>
The above introduces the method of processing the hyperlink to the txt text, which is not opened directly but downloaded after clicking. It includes the content of the happy life of otaku in the ancient harem txt. I hope it will be helpful to PHP tutorial is helpful for those who are interested.