Home > Backend Development > PHP Tutorial > The difference between include, include_once, require, require_once, requireonceinclude_PHP tutorial

The difference between include, include_once, require, require_once, requireonceinclude_PHP tutorial

WBOY
Release: 2016-07-12 09:05:24
Original
880 people have browsed it

include, include_once, require, require_once difference, requireonceinclude

1. include, require includes a file at the location where it is called.

2. The include_once, require_once function has the same function as include, but it will first verify whether the file has been included. If it is already included, include_once will no longer be executed. Others are the same as include.

3. The main difference between require and include is: a. When require fails, the script will stop running, but when include fails, the script will continue to execute. b. Regardless of the location of require, the specified file will be included in the script where require appears. For example, even if require is placed in an if statement that evaluates to false, the specified file will still be included.

4. Use require_once to solve the problem of file being overwritten. The require_once function ensures that the file is included only once. After encountering require_once, subsequent attempts to include the same file will be ignored.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1069667.htmlTechArticleThe difference between include, include_once, require, require_once, requireonceinclude 1. include, require is included at the location where it is called. a file. 2. Include_once, require_once functions...
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