出于某种原因,h1只表示欢迎来到Arma 3 Life Highway Patrol的
有什么想法吗?
<?php
//This file will contain the page name and the credits!
function thisPage($page){
if ($page == 'sops.php'){
$Npage = 'SOPs';
return $Npage;
}elseif ($page == 'changelog.php'){
$Npage = 'Website Changelog';
return $Npage;
}elseif ($page == 'ftodocuments.php'){
$Npage = 'FTO Documents';
return $Npage;
}elseif ($page == 'index.php'){
$Npage = 'Homepage';
return $Npage;
}elseif ($page == 'login.php'){
$Npage = 'FTO Login Page';
return $Npage;
}elseif ($page == 'socialstuff.php'){
$NPage = 'Social Stuff';
return $Npage;
}else{
return false;
}
}
?>
<?php
$findPage = (basename($_SERVER['PHP_SELF']));
$thisPageName = thisPage($findPage);
?>
<h1>Welcome to the Arma 3 Life Highway Patrol's <?php echo $thisPageName ?></h1>
<p> Website created by Austin Sharp and assisted by Greyson Henley.</p>
答案 0 :(得分:0)
您可以使用此t1.readLog();
它将给出文件名并打印正确的输出。
答案 1 :(得分:0)
问题是你的变量。您有两个不同的变量:
$NPage = 'Social Stuff';
return $Npage;
$NPage
和$Npage
他们不匹配。
答案 2 :(得分:0)
我实际上只是测试了MAMP上的代码并且它应该正常工作(将文件保存为index.php)。你正在测试什么服务器?
在黑暗中拍摄,但尝试将$ _SERVER [&#39; PHP_SELF&#39;]更改为$ HTTP_SERVER_VARS [&#39; PHP_SELF&#39;]。
也许您可以尝试使用phpinfo()来查看全局php变量是否为空。