Home > Article > Backend Development > How to hide the real download path in php
php method to hide the real path: first create a "test.html" file; then create a "dow.php" file; finally pass "if($_REQUEST["id"]==1){ ...}" method to hide the real file path.
Recommended: "PHP Video Tutorial"
php hidden download real path example code
Sometimes when we use PHP to download, we don’t want others to see the real path of the file. What should we do? Let me use an example to show you how to hide the real file path.
test.html file
<a href="dow.php?id=1">100素材网</a>
dow.php file
<?php header("Content-type:application"); if($_REQUEST["id"]==1){ $fileurl="a/Discuz_X3.1_SC_GBK.zip"; header("Content-Disposition: attachment; filename=$fileurl"); readfile($fileurl); exit(0); } ?>
The above is the detailed content of How to hide the real download path in php. For more information, please follow other related articles on the PHP Chinese website!