Home >Backend Development >PHP Tutorial >A brief analysis of the method of forcing downloading of files in PHP
This way, the file can be downloaded directly instead of opened. Principle analysis: 1. header ("Content-Type: application/force-download"); //Force download; 2. header ('Content-Disposition: attachment; filename="'.$filename.'"'); //Implement file download. Finally, readfile($filename) reads the file for download. |