Php include, include_once, require, require_once

Source: Internet
Author: User

Include_once is similar to require_once. It is used to check whether the contained file has been included. If so, it will not be executed. Otherwise, it will be included again. the reason for this is that if you have clarified include and require. that's okay.
The difference between include and require:

The content contained in the require () function is considered as an integral part of the current file. Therefore, when the contained file has a syntax error or the file does not exist, the PHP scripts of the current file are not executed.
The include () function is equivalent to specifying the path of the file. When the file to be included has errors, the program running will not be affected.
The include function can be used to determine whether the include function is included or not, while require is included in all situations. Therefore, it is worth noting that!
We recommend that you include dynamic files, that is, variables, functions, and classes. however, some people have been analyzing the execution efficiency of the two functions some time ago. I did not test this by myself. I will try it again later.

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.