Home > Backend Development > PHP Tutorial > php中用require、require_once、include、include_once

php中用require、require_once、include、include_once

WBOY
Release: 2016-07-29 09:16:10
Original
934 people have browsed it

In PHP, to realize the mutual reference of two PHP files (calling functions in other files), we need to use the four methods require, require_once, include, and include_once. In terms of usage, the syntax of these four methods is the same. of. The following is an example usage of require (the other 3 reference methods are the same):

1. The difference between require_once, include and include_once:

require_once and
include_once

will be judged first. If it is found that func03.php has been introduced, it will not be introduced again. The difference between


include and require:

include if an error occurs when referencing, the program will continue to execute, and a warning will be reported; if an error occurs in require, the program will terminate, and an error will be reported

Copyright statement: This article This is an original article by the blogger and may not be reproduced without the blogger's permission. The above introduces the use of require, require_once, include, and include_once in PHP, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

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