What is the difference between statement include and require? To avoid including the consent file multiple times, is it available? Statements to replace them?

Source: Internet
Author: User

(1) The Include () is read and evaluated every time the file is executed; require () file is processed only once (actually the file contents replace the Require () statement)

(2) require () is usually placed in the first part of the PHP script include () and require (), usually placed in the process control of the processing section, the PHP script file read the Include () statement, it contains the file read in, this way, The process of executing the program can be simplified

(3) require () and include () statements are language constructs, not real functions, and can be like other language constructs in PHP

(4) require () contains file failure, stop execution, give error (fatal);

(5) include () is often used for dynamic inclusion. Usually the file is automatically loaded, even if the load error, the entire program continues to execute a page declaration, the other page calls the package function file failed, continue to execute down, return a warning

(6) the include_once () and require_once () statements also include and run the specified file during script execution, and the only difference from the include () require () is that if the code in the file is already included, it will not be included again.

8. Statements include and require can include another file in the current file, the difference is ____; to avoid including the same file multiple times, you can use the statement __require_once| | include_once__ to replace them.

What is the difference between statement include and require? To avoid including the consent file multiple times, is it available? Statements to replace them?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.