Home > Backend Development > PHP Tutorial > Usage and differences of require.include.require_once.include_once_PHP Tutorial

Usage and differences of require.include.require_once.include_once_PHP Tutorial

WBOY
Release: 2016-07-20 11:00:49
Original
1087 people have browsed it

The usage and difference of require.include.require_once.include_once ​

Four ways to reference files: require. include. require_once. include_once.
The usage method of require is as require("MyRequireFile.php");. This function is usually placed at the front of the PHP program. Before the PHP program is executed, it will first read in the file specified by require and make it a part of the PHP program web page. Commonly used functions can also be introduced into web pages in this way.

The use method of include is include("MyIncludeFile.php");. This function is generally placed in the processing part of flow control. The PHP program webpage only reads the include file when it reads it. In this way, the process of program execution can be simplified.

The methods of require_once and include_once are the same as the methods of require and include. The only difference is that require_once and include_once will only include the file once and will not include it repeatedly.


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/445496.htmlTechArticlerequire.include.require_once.include_once Usage and difference between four methods of referencing files: require . include . require_once . include_once. The usage method of require is as require(MyReq...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template