Php include usage

Source: Internet
Author: User
: This article mainly introduces the include usage of php. if you are interested in the PHP Tutorial, refer to it. I am used to the C ++ syntax and think that include contains some header files. PHP's include function is more than that.

1. include some class definition files and function files, which are commonly used;

2. contains HTML files

Include "header.htm ";

The preceding header.htm can be integrated with PHP statements.

Because it can contain htm static files, you can design a Cache mechanism. for example, you can divide some pages into several parts, and some parts that read the database's efficiency can be cached into HTML, and thenInclude introduction.

3. the include file can return;

$ I = include 'ABC. php ';

Source code example of abc. php:

Return "hello world ";

?>

Echo $ I; will output hello world.

If abc. php does not return. then echo $ I will output 1

Include variable range

$ A = "hello world ";

Include "abc. php ";

$ A is visible in abc. php;

The variables in abc. php are also visible after the include; the usage is flexible!

The above introduces the include usage of php, including some content, and hopes to help friends who are interested in PHP tutorials.

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.