Home  >  Article  >  Backend Development  >  How to hide the real download path in php

How to hide the real download path in php

藏色散人
藏色散人Original
2020-08-08 10:49:152636browse

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.

How to hide the real download path in php

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn