这个和C语言中的include是同样的用法,如果一个php文件中有一句include a.php,那么执行的时候就会把a.php的内容插入到这个php文件中。
举个例子,我现在有一个名为helloworld.php的文件,它的内容如下:
<?phpecho ‘hello world!‘;?>
我还有一个名为new.php的文件,它的内容如下:
<?phpinclude ‘helloworld.php‘;echo ‘i am the page of new.php‘;?>
执行结果如下:
php学习笔记-include
原文地址:https://www.cnblogs.com/yfish/p/8453440.html