include() / require()
 
Include and require are here to include certain content from a file into another file. For example you build a webpage. Put the navigation into nav.php and you can include it into every other file on your site. So, you have to create the navigation only once.
Here is how to include another file:
<?php
include("nav.php");
?>

Include will parse the code from an external file and put it inside your document after. Require will first include the file and the parse the whole thing. Generally its bether to use require.

NOTE: Because of an error in PHP, you cannot include a file with an absolute path. It would return an error. Use a relative path instead:

false:
<?php
require("http://domain.com/files/nav.php");
?>

correct:
<?php
require("../../nav.php");
?>

or:
<?php
require("files/nav.php");
?>
 
admin / Dec 06, 2003
   
 
 
Login: 
Pass: 
 
 
     
     
2004 - 2018 / lookass.ch
makememad@lookass.ch