The difference between include and require in PHP

Source: Internet
Author: User
The following are the differences between the include () statement and the Require () statement in the PHP code:

1. Different loading mode and error handling mode

  • The include () statement can be placed in the process control of the program, and when the program executes, the file is loaded in. When an error occurs (such as a file does not exist) only a warning is generated

  • The Require () statement is usually placed at the beginning of the program and is now loaded into the program at execution time. Terminating the script when an error occurs, such as when the file does not exist.

2.php Performance

  • The inlcude () statement reads and evaluates files every time they are executed.
  • The Require () statement performs a file processing only once (in effect, the file contents replace the Require () statement.

3.include_once () and require_once ()

  • Include_once () includes and runs the file during the script execution period and will not be included again if the file is already included.

  • Require_once () checks whether the file has been loaded at the time of script execution. If the load is not loaded again, such as a file defined a type, if the file is loaded two times an error occurs

'). addclass (' pre-numbering '). Hide (); $ (this). addclass (' has-numbering '). Parent (). append ($numbering); for (i = 1; i <= lines; i++) {$numbering. Append ($ ('

  • '). Text (i)); }; $numbering. FadeIn (1700); }); });

    The above introduces the differences between include and require in PHP, including the contents of the content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    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.