Share PHP function require () Specific tips for using _php tutorials

Source: Internet
Author: User
ForWhen using PHP function require () to include an external PHP file, the contents of the external file will be included in the PHP file as long as the PHP file is executed, and the error will be given when the external file contains an error, and the execution of the PHP file is stopped.

Example:

program code to invoke file Config.inc:

 
  
  1. < ? PHP
  2. echo "This is what is called: Hello!";
  3. ?>

Program code for current script example01.php:

 
  
  1. < ? PHP
  2. echo "Example of code reuse:";
  3. Require (' config.inc ');
  4. Call another file Config.inc,
    Content in output Config.inc
  5. ?>

Instance Location: mrsl4example01.php

The result is: Code Reuse Example: This is what the PHP function require () is called: Hello! Using the Require function.


http://www.bkjia.com/PHPjc/446230.html www.bkjia.com true http://www.bkjia.com/PHPjc/446230.html techarticle for the use of PHP function require () contains external PHP files, as long as the PHP file itself is executed, the contents of the external file will be included in the PHP file itself, when the inclusion of external files error ...

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