Include in PHP

Include in PHP


Posted in : PHP Posted on : December 31, 2010 at 6:42 PM Comments : [ 0 ]

This section contains the detail about Include in PHP.

Include in PHP

In this tutorial you will learn how to used include() function in a PHP web application. The include() function takes all the content in a specified file and includes it in the current file. If an error occurs, the include() function generates a warning, but the script will continue execution.

    In this tutorial  used two php files

  • header.php
  • include.php

The 'header.php' is common file that used one image for logo. The 'header.php'  code given below :

<img src="include-logo.gif" alt="Image not found" />

The 'include.php' php file is main file that code given below :

<html>
<body>
<?php include("header.php"); ?>
<h2>Welcome to home page.</h2>
<p>Hi............</p>
</body>
</html> 

The 'include.php'  include 'header.php' file if include() function generates a warning , but the script will continue execution.

Output:-

Download Source Code

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics