Example
Use include_once to add a footer to a page:
html
<!DOCTYPE html>
<html>
<body>
<h1>Welcome to my home
page!</h1>
<p>Some text.</p>
<p>Some more text.</p>
<?php include_once
'footer.php';?>
</body>
</html>
Definition and Usage
The include_once keyword is used to embed PHP code from another file. If the file is not found, a warning is shown and the program continues to run. If the file was already included previously, this statement will not include it again.
Related Pages
- The
includekeyword - The
requirekeyword - The
require_oncekeyword