Include, include_once, require, require_once

Source: Internet
Author: User
: This article mainly introduces the differences among include, include_once, require, and require_once. if you are interested in PHP tutorials, refer. 1. include, RequireIt contains a file at the called location.

2. include_once,RequireThe _ once function has the same function as include, but it first verifies whether the file is included. If it already exists, revoke de_once is not executed. Others are the same as include.

3,RequireThe main difference with include:,RequireWhen an error occurs, the script stops running. If an include error occurs, the script continues to run. B.RequireThe location of the file will be included inRequire. For exampleRequireIn the if statement where the calculation result is false, the specified file is still contained.

4. useRequire_ Once can solve the problem of file overwriting.RequireThe _ once function ensures that the file is only contained once. InRequire_ Once will be ignored when you attempt to include the same file later.

The above introduces the differences between include, include_once, require, and require_once, including The require content. I hope to help those who are interested in PHP tutorials.

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.