-
- $filename = 'path + actual file name';
- //Type of file
- header('Content-type: application/pdf');
- //Name displayed when downloading
- header ('Content-Disposition: attachment; filename="Save file name.pdf"');
- readfile("$filename");
- exit();
- ?>
Copy code
Provide an online withdrawal There are many ways to implement downloading using php header functions.
-
- if (isset($link))
- {
- Header("HTTP/1.1 303 See Other");
- Header("Location: $link");
- exit;
- }
- ?>
-
Copy the code
$link is the actual path of the file.
Attached is a list of Content-Type types of HTTP headers that the server responds to.
|