Use require_once
to add a footer to a page:
<!DOCTYPE html>
<html>
<body>
<h1>Welcome to my home page!</h1>
<p>Some text.</p>
<p>Some more text.</p>
<?php require_once 'footer.html';?>
</body>
</html>
The require_once
keyword is used to embed PHP code from another file. If the file is not found, a fatal error is thrown and the program stops. If the file was already included previously, this statement will not include it again.
The require
keyword
The include
keyword
The include_once
keyword
Read more about including files in our PHP Include Files Tutorial.
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!