PHP include,include_once,require,require_once_php Tutorials

Source: Internet
Author: User
The role of Include_once and require_once is similar, that is, in the inclusion of the time to check whether the contained files have been included, if included, then do not execute, otherwise included. The reason I said this first is because if you put the include, Require figured it out. That's fine.
Now the difference between include and require:

The Require () function contains content that is considered a part of the current file, so the PHP script for the current file is no longer executed when there is a syntax error in the included file or the file does not exist.
The Include () function is the equivalent of specifying the path to the file, which does not affect the program's operation when the contained file is in error.
The Include function can be judged whether it is included, and require is included in any case. So this is worth noting!
It is recommended that you include dynamic files, which are variables, functions, and already classes. But some time ago, someone was analyzing the efficiency of the execution of two functions. I didn't test it myself.

http://www.bkjia.com/PHPjc/319423.html www.bkjia.com true http://www.bkjia.com/PHPjc/319423.html techarticle The role of Include_once and require_once is similar, that is, in the inclusion of the time to check whether the contained files have been included, if included, then do not execute, otherwise included. I'll say this first .

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