你可以将它放在htdocs /目录之外,并将images/dir mod_rew到image.php或其他东西.所以url/images/test.jpg会转换为image.php?path = test.jpg
image.php可能看起来像这样:
<?php
if($loggedin) {
header("Content-Type: image/jpeg");
echo file_get_contents("../images/".$_GET["path"]);
}
?>
Run Code Online (Sandbox Code Playgroud)
不要忘记消毒输入!您不希望用户访问任意文件.
| 归档时间: |
|
| 查看次数: |
1866 次 |
| 最近记录: |