Home >php教程 >php手册 >php include()调用文件简单实例

php include()调用文件简单实例

WBOY
WBOYOriginal
2016-06-13 09:55:011117browse

include 'include.php教程';    //引用include.php文件

echo a();

//结果 bb
?>

include.php文件如下

//建立include.php以供其他文件调用
function a()     //定义函数a
{
  b();      //在函数a中调用函数b
}
function b()     //定义函数b
{
  c();      //在函数b中调用函数c
}
function c()     //定义函数c
{
  echo('bb');  //输出一个php backtrace
}
a();       //使用函数a
?>
其它提示:

在使用require()语句调用文件时,如果没有找到文件,require()语句会输出错误信息,并且立即终止脚本的处理.而include()语句在没有找到文件时则会输出警告,不会终止脚本的处理

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn