We normally used for include a class or config file like
Include “config.php”;
Now I telling you second way for include file.
Suppose you have main file is index.php and now you have to include
config.php which file in same directory.
Now write following code in config.php
<?php
if(!defined('INCLUDE_CHECK'))
die('You are not allowed to execute this file directly');
?>
After these code your configuration as per your requirement.
Now when you want to include these config file that time if
you include in normally way than you got error like 'You are not allowed to execute this file directly’.
For include these file you have to write like
<?php
define('INCLUDE_CHECK',1);
?>
If you are write without above code than you got error.
USE of It.
Normally it’s you may use. By
use of you got a benefit that if someone got your file name than they cannot
easily include and you may got some secure include of file.
No comments:
Post a Comment