Hay people, here is another tutorial for beginners, if you have started writing some php web pages, like function, and modules, sure is better to seperate codes to make it neat.
Today we are going to talk about how you can add another web page to another one using PHP the universal Server language, by this means you can import Scripts and HTML Files.
A web page containing .php extension can or .html can can be imported using PHP build in function call 'require' with this you can import any web page to your current file.
for example
require 'filename.extension';
date.php
<h3>Today Date: <?php $today = date("D M d Y"); echo $today; ?></h3>
to import and display the script above is just to use the require function like this, this will produce an error if the date.php is not found.
<?php
require 'date.php'; // print the current date
?>
The include statement does thesame thing, just that the difference is that if the date.php is not found it will not produce an error message to the user.
Now, the require_once and include_once accomplish thesame result, just that it will not reload a file which is already been reqyured or include.
Today we are going to talk about how you can add another web page to another one using PHP the universal Server language, by this means you can import Scripts and HTML Files.
A web page containing .php extension can or .html can can be imported using PHP build in function call 'require' with this you can import any web page to your current file.
for example
require 'filename.extension';
date.php
<h3>Today Date: <?php $today = date("D M d Y"); echo $today; ?></h3>
to import and display the script above is just to use the require function like this, this will produce an error if the date.php is not found.
<?php
require 'date.php'; // print the current date
?>
The include statement does thesame thing, just that the difference is that if the date.php is not found it will not produce an error message to the user.
Now, the require_once and include_once accomplish thesame result, just that it will not reload a file which is already been reqyured or include.
No comments:
Post a Comment