$\u获取并包含php
我似乎无法访问nav2.php。有什么想法吗?很抱歉,我在构建它时很匆忙。这里发生的事情是在我的index.php右侧导航中,我已经为我的导航分离了php,它是nav1,nav2,。但我似乎无法通过导航进行更改,我有此代码,我知道缺少一些内容。您的问题到底是什么?您确认了$u GET['nav'中存储的内容了吗?var_dump为我们提供。$linkn的价值是多少?如果需要,您需要这样做!空$_GET['nav']{{如果$linkn=='nav2',为什么不使用else?注意:允许的数组确保人们无法检索任何其他文件,然后数组url注入中的名称谢谢,很酷,…您可以看穿代码。。$\u获取并包含php,php,get,include,Php,Get,Include,我似乎无法访问nav2.php。有什么想法吗?很抱歉,我在构建它时很匆忙。这里发生的事情是在我的index.php右侧导航中,我已经为我的导航分离了php,它是nav1,nav2,。但我似乎无法通过导航进行更改,我有此代码,我知道缺少一些内容。您的问题到底是什么?您确认了$u GET['nav'中存储的内容了吗?var_dump为我们提供。$linkn的价值是多少?如果需要,您需要这样做!空$_GET['nav']{{如果$linkn=='nav2',为什么不使用else?注意:允许的数组确保人
if (isset($_GET["nav"])) {
if (!empty($_GET)) {
$linkn = $_GET['nav'];
if ($linkn == "nav1") {
include("nav1.php");
}
if ($linkn == "nav2") {
include("nav2.php");
}
}
else {
include("nav1.php");
}
}
$include = $_GET;
//Allowed navigations
$allowed = array('nav1', 'nav2');
//var must exist, have value and exist in allowed array
if (isset($_GET["nav"]) && !empty($_GET) && in_array($include, $allowed)){
include($include.'.php');
} else {
include('nav1.php');
}