如果我当前的页面采用这种格式......
http://www.mydomain.com/folder/mypage.php?param=value
Run Code Online (Sandbox Code Playgroud)
有一个简单的方法来实现这一目标
http://www.mydomain.com/folder/mypage.php
Run Code Online (Sandbox Code Playgroud)
用javascript?
在我的php文件中,我使用$ _GET参数在我的服务器上打开一个文件,如下所示:
$filename = $_GET["filename"];
$content = file_get_contents("/path_to_files/".$filename);
Run Code Online (Sandbox Code Playgroud)
我的问题是,如何使这更安全,以便用户无法访问服务器上父文件夹中的文件?这是我需要在服务器上执行的操作,例如权限和/或配置吗?或者应该$filename
在我的php文件中验证?提前致谢!