[英]linking to another php page and include header and footer
我是初学者,只是想学习php。 下面是我的index.php文件:
<?php
include("header.php");
require_once('connect.php');
include("home.php");
include("footer.php");
?>
我创建了一个简单的测试站点,其中包含index.php文件中的主页。 我必须使用include(header.php);
如果我想包含相同的代码,在每个页面上? 谢谢。
你没有在每个页面上包含header.php。 尝试这个:
<?php include("header.php");?>
<div class="container">
<?php include ("home.php");?>
</div>
<?php include ("footer.php");?>
保持页眉和页脚,只需更改内容(home.php,otherpage.php,...)。 我建议你使用jQuery动态加载container
的内容
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.