July 26, 2017

Core PHP: Include & Require (5.18)

include


Using this approach, we have the ability to include the same header.php file into multiple pages.

<html>
  <body>

  <?php include 'header.php'; ?>

  <p>This is a paragraph</p>
  </body>
</html>

Result:
Example: include


Files are included based on the file path.
You can use an absolute or a relative path to specify which file should be included.

No comments:

Post a Comment