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:-
[ 0 ] Comments