$top_file_path="/common/top.html";
$bottom_file_path="/common/bottom.html";
$index_file_path="/template/index.html";
//读取头部和底部模板
$top_str= file_get_contents($top_file_path);
$bottom_str=file_get_contents($bottom_file_path);
//读取首页模板
$index_str=file_get_contents($index_file_path);
//替换index页内容
if(strpos($index_str,'{hoz:top_html_template}')!=false)
{
$html_top_complete= str_replace('{hoz:top_html_template}',$top_str,$index_str);
}
if(strpos($index_str,'{hoz:bottom_html_template}')!=false)
{
$index_html= str_replace('{hoz:bottom_html_template}',$bottom_str,$index_str);
}
if(!file_exists('index.html')&&$index_html!="")
{
//输出模板页内容
printf($index_html);
}else
{
header('HTTP/1.1 301 Moved Permanently');
header('Location:index.html');
}
?>