Skip to content Skip to sidebar Skip to footer

Php - Load Header From Another File

I've run into problem whereby I'm not able to include a header file into a PHP file In the code below, I've removed the original content as it's quite big & anyway what the cod

Solution 1:

Well, first of all, I don't think you copied the code correctly to here. As my debugging eyes can see, you got 2 issues:

  1. Line 1: < is missing at the start. Change it to <?php. (Maybe copy paste error?)
  2. <?php include('header.php'); is missing closing tag. Change it to: <?php include('header.php'); ?>

If you get a blank page, you probably have some errors. Try finding the "error.log" file in you working directory or add the following code at the start of the page:

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

Post a Comment for "Php - Load Header From Another File"