One, what is the use?
Server-side inclusions (server Side Include,ssi) are used to create functions, headers, footers, or elements that can be reused on multiple pages. The Include file reuses the file and saves a lot of work.
Second, how to use?
Include ' filename ';
Or
Require ' filename ';
1.php
echo"Hello ";include'2.php';?>
2.php
echo"World.";?>
In the browser access 1.php will get (note that at this point 1.php and 2.php are placed in the same folder):Hello World.
Iii. What is the difference between include and require?
In terms of error handling:
Require generates a fatal error (E_COMPILE_ERROR) and stops the script
Include only generates a warning (e_warning), and the script continues
Please use at this time:
Please use require at this time: when the file is requested by the application.
Use include at this point: when the file is not required, and the application should continue to run when the file is not found.
Copyright NOTICE: This article for Lshare original article, need to reprint please contact me, have questions welcome comments or private messages.
The above introduces the include and require in PHP, including the content, I hope that the PHP tutorial interested in a friend to help.