Include, include_once, require, require_once differences

Source: Internet
Author: User
Include, include_once, require, require_once differences 1. include, require contains a file at the called location. 2. the functions of include_once and require_once are the same as those of include. However, they first verify whether the file is included. If it already exists, revoke de_once is not executed. Others are the same as include. 3. differences between r include, include_once, require, and require_once

1. include and require include a file at the called location.

2. the functions of include_once and require_once are the same as those of include. However, they first verify whether the file is included. If it already exists, revoke de_once is not executed. Others are the same as include.

3. the main difference between require and include is that when a and require errors occur, the script will stop running, and when the include errors occur, the script will continue to be executed. B. regardless of the location of require, the file will be included in the script where require appears. For example, even if require is placed in an if statement whose calculation result is false, it still contains the specified file.

4. use require_once to solve the problem of file overwriting. The require_once function ensures that the file is only contained once. If you encounter require_once and try to include the same file later, it will be ignored.

Small Shard on the first floor
Learned

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.