Include files if the current Web site development project is large, you must have a deep understanding of code reuse. For example, whether it is HTML or PHP code block, as long as the project is large enough, for example, if you have 1000 web pages, even if you modify the footer that contains the copyright information only once a year, it will hurt you. PHP can use some functions to help you reuse code. The specific functions you need depend on the content you intend to reuse. The main functions are: * include () and include_once () * require () and require_once () include () functions contain the given files, for example: include (/home/me/myfile); Any code in the include file will be executed within the variable range of the code page where include () is located. You can include static files on the server or target files on other servers by combining include () and fopen (). The include_once () and include () functions are similar, but the function checks whether the code in the included file has been included in the current script. If the code has been included by the script, the function will no longer contain the corresponding files. The require () function replaces itself with the content of the given file. This replacement process occurs when the PHP engine compiles your code instead of executing the code phase, which is different from include (). The latter is first computed and then added to the document block. The require () function is mostly used for static elements, while the include () function is mainly used for dynamic elements. Similar to include_once (), the require_once () function checks whether the given code has been inserted into the document. If so, the given Code will not be inserted into the document again. I recommend that you use the require function for information such as copyright, static text, and other elements without variables. The require function is also recommended for elements that depend on other scripts to implement their own content. For example: Something [A lot of content] On the other hand, I often use the include () function to put the function library or similar content out of the script: Something [A lot of content] You will certainly ask: "So, where are the files that are encoded or required from ?" The answer is simple: "Your system ." However, sometimes some codes contain security information such as database connection functions with user names and passwords. In such cases, it is obvious that, you certainly don't want these things to be part of the document as well. You can place the included files (encoded or required) anywhere in the system, as long as the PHP you can use can access these files. You can also give these files any file extension you want to give, or do not have an extension. Using the include () and require () functions makes it easier to process elements that are common or frequently changed on the Web site.