If we need to hide the download file path, we only need to enter it directly, without the need to jump to the path. let's look at an instance and hope it will help you. the code is as follows: & lt ;? Php
If we need to hide the download file path, we only need to enter it directly, without the need to jump to the path. let's look at an instance and hope it will help you. the code is as follows:
- // Set the header information and forcibly download the object
- Function download_send_headers ($ filename ){
- // Disable caching
- $ Now = gmdate ("D, d m y h: I: s ");
- Header ("Expires: Tue, 03 Jul 2001 06:00:00 GMT ");
- Header ("Cache-Control: max-age = 0, no-cache, must-revalidate, proxy-revalidate ");
- Header ("Last-Modified: {$ now} GMT ");
- // Force download
- Header ("Content-Type: application/force-download ");
- Header ("Content-Type: application/octet-stream ");
- Header ("Content-Type: application/download ");
- // Disposition/encoding on response body
- Header ("Content-Disposition: attachment; filename = {$ filename }");
- Header ("Content-Transfer-Encoding: binary ");
- }
- Using file_name+'download.csv ';
- $ File_path = dirname (_ FILE _). '/file/'. $ file_name;
- Download_send_headers ($ file_name );
- Readfile ($ file_path );
- Exit;
- ?>