The difference between include,include_once,require,require_once

Source: Internet
Author: User
1, include, require contains a file at the location where it was called.

2, include_once, therequire_once function works the same as include, but it first verifies that the file is already included. If it is already included, Include_once is no longer executed. Other same as include.

3,require and include the main difference, a,require error, the script will stop running, and include error in the case, the script will continue to execute. b, regardless of the location of the require , the development files will be included in the script that appears require . For example, even if the require is placed in an if statement that evaluates to FALSE, the specified file will still be included.

4, use require_once can solve the problem that the file is overwritten. The require_once function ensures that the file is included only once. After encountering require_once, the subsequent attempt to include the same file is ignored.

The above describes the difference between the include,include_once,require,require_once, including the require aspects of the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.