php根据传递的不同参数在同一页面内显示不同的内容除了if ELSE ,SWITCH 语句方法还可能过下面数组方法来实现。
<?phpinclude("header.php");
$page = isset($_GET['page']) ? trim(strtolower($_GET['page'])) : "home";
$allowedPages = array(
'home' => './home.php',
'about' => './about.php',
'services' => './services.php',
'gallery' => './gallery.php',
'photos' => './photos.php',
'events' => './events.php',
'contact' => './contact.php');
include(isset($allowedPages[$page]) ? $allowedPages[$page] : $allowedPages["home"]);
include("footer.php");