Use and difference of require. include. require_once.include_once
Four file reference methods: require. include. require_once. include_once.
The use of require is as follows: require ("MyRequireFile. php ");. This function is usually placed at the beginning of the PHP program. Before the PHP program is executed, it will first read the file specified by require to make it a part of the PHP program webpage. This method can also be used to introduce common functions into webpages.
Include usage methods such as include ("mydomaindefile. php ");. This function is generally placed in the Process of process control. The PHP program webpage reads the include file. In this way, the process during program execution can be simplified.
The require_once and include_once methods are the same as those of require and include. The difference is that require_once and include_once only contain the file once and do not contain the file repeatedly.