Server Side Includes
Server Side Includes :
Server side includes SSI : include() or require() are used for inserting the content of one php file or any other file into the current php file before the server executes it.
1. Include() : generates a working incase the specified file cannot be loaded, but the script will continue execution.
2. Require(): generates a fatal error, and the script will stop incase the specified file cannot be loaded.
these two functions are used to create functions,headers,footers,or elements that will be reused on multiple pages.
The advantage of using server side include is you can create a standard header,footer,or menu file for all your web pages. When the footer needs the header needs to be uploaded, you need to update only the include file.
Note: it is not possible to include morethan one file with the same function definition present inside that because in a php program it is not possible to redeclare a function.
$res = $x+$y;
- - - - - - - - - - - ;
Include(‘functions.php’) or require(‘functions.php’)
Echo “sum=” .addName(11,22);
What is the difference between include() and include_once() ?
Includes_once statement includes and evaluates the specified file during the execution of a script.this is a behavior similar to the include() statements, with the only difference being that if the code from a file has already been included, it will not be included again.
Echo “Indian tech”;