试图加载我的第一个PHP网站在浏览器中; Firefox显示奇怪的编码标签,IE询问我是否想“打开”文件,而不是加载页面。我认为我复制了一个教程100%,所以我认为它应该工作..还有什么我需要做的做这个工作,或者我可能有一些代码错误?
的functions.php
function displayContent($content) {
echo implode($content);
}
function displaySidebar($sidebar) {
echo implode($sidebar);
}
?>的template.php
indexheader
的index.php
//include our functions
require_once ('functions.php');
// declare arrays
$content=array();
$sidebar=array();
//handle page request
$t=$_GET['t'];
if($t == 'about') {
//display about page //can we load a full template?
$content[]="
about
";$content[]="
Content
";$sidebar[]="";
} else {
//display the home page
$content[]="
home page
";$content[]="
Content
";$sidebar[]="";
}
//Important this is on bottom
//I guess content must be ready on load.
include ('template.php');
?>OUTPUT :(火狐)
about"; $content[]="
Content
"; $sidebar[]=""; } else { //display the home page $content[]="
home page
"; $content[]="
Content
"; $sidebar[]=""; } //Important this is on bottom //I guess content must be ready on load. include ('template.php'); ?>