: This article mainly introduces include and require in PHP. For more information about PHP tutorials, see. 1. what is the purpose?
Server Side Include (SSI) is used to create functions, headers, footers, or elements that can be reused on multiple pages. Including files reuse files, saving a lot of work.
II. how to use it?
Include 'filename ';
Or
Require 'filename ';
1. php
2. php
Access 1. php in the browser (note that 1. php and 2. php are stored 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 warnings (E_WARNING), and the script continues
Use:
Please use require at this time: when the file is requested by the application.
Please use include at this time: when the file is not required and the application should continue to run when the file is not found.
Copyright Disclaimer: This article is an original Lshare article. if you need to reprint it, please contact me. if you have any questions, please comments or private messages.
The above introduces include and require in PHP, including some content, and hope to be helpful to friends who are interested in PHP tutorials.