【发布时间】:2014-02-21 09:09:25
【问题描述】:
我有一个 index.php,我想在其中生成它应该显示的页面模板。 因此,当您在 index.php 上时,您会看到 home.php 模板。
如果您在 index.php?chapter=chapter-name 上,您会看到 chapter.php 模板。 如果您在 index.php?marker=marker-name 上,您会看到 marker.php 模板。
我现在有以下内容:
<?php
if(!isset($_GET["chapter"])){
$page = "root";
include_once('view/home.php');
} else {
$page = $_GET["chapter"];
switch($page){
case "chapter-name":
include_once('view/chapter.php');
break;
case "marker-name":
include_once('view/marker.php');
break;
}
}
?>
谢谢!
【问题讨论】:
-
现有代码有问题吗?你有什么问题?
-
你在这里给出答案或问题吗?
标签: php variables get templating isset