Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/261.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用php阻止url指定的文件夹或路径_Php_Url_Path - Fatal编程技术网

使用php阻止url指定的文件夹或路径

使用php阻止url指定的文件夹或路径,php,url,path,Php,Url,Path,我有一个块指定的路径。 例如http://example.com/image 或http://example.com/file.php 有人去这个路径,它需要显示你没有权限或重定向另一个页面。。如何为Php实现这一点。。给我举个好例子 您可以在每个要阻止直接访问的目录中添加index.php文件。Inside index.php添加 echo "<script>location.href='your_redirect_path';</script>"; or head

我有一个块指定的路径。
例如http://example.com/image 或http://example.com/file.php 有人去这个路径,它需要显示你没有权限或重定向另一个页面。。如何为Php实现这一点。。给我举个好例子

您可以在每个要阻止直接访问的目录中添加index.php文件。Inside index.php添加

echo "<script>location.href='your_redirect_path';</script>"; or 

header("Location: your_redirect_path");
exit;

你已经试过什么了?