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