Differences between require and include in php

Source: Internet
Author: User
The difference between require and include in php is as follows. if URLfopenwrappers is configured in the ini configuration file, you can use the URL to contain remote files. The require cannot contain the control structure, and cannot contain the differences between require and include in the return statement php.
  • If the URL fopen wrappers is configured in the php. ini configuration file, you can use the URL to include remote file calls.
  • The require cannot contain a control structure, nor can it contain a return statement, which may cause a processing error.
  • Require will replace the content of the contained file with this point during the first execution, and include will be called again each time. therefore, require cannot contain different files in the cyclic weight.
  • Require can access the variables in the current scope
  • If an error occurs in require, the system immediately stops running and reports an exception. If include displays an error message, the system continues to run the request.
  • In a condition statement, no matter whether the condition is true or not, the contained content will be introduced, even if there is no chance of execution.

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.