Example
Use require 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
require
'footer.php';?>
</body>
</html>
Definition and Usage
The require 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.
Related Pages
- The
includekeyword - The
include_oncekeyword - The
require_oncekeyword