91-9990449935 0120-4256464 |
PHP Include FilePHP allows you to include file so that a page content can be reused many times. There are two ways to include file in PHP.
AdvantageCode Reusability: By the help of include and require construct, we can reuse HTML code or PHP script in many PHP scripts. PHP include examplePHP include is used to include file on the basis of given path. You may use relative or absolute path of the file. Let's see a simple PHP include example. File: menu.html File: include1.phpOutput: PHP require examplePHP require is similar to include. Let's see a simple PHP require example. File: menu.html File: require1.phpOutput: PHP include vs PHP requireIf file is missing or inclusion fails, include allows the script to continue but require halts the script producing a fatal E_COMPILE_ERROR level error.
Next TopicPHP Cookie
|