欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

php include 跟 require区别

程序员文章站 2022-06-03 20:58:05
...
php include 和 require区别
刚接触php不久,碰到include和require, 在网上查了很久,很多人也做了比较,有些不大正确,有误导之嫌,最权威的正确的答案在这里:http://cn.php.net/manual/zh/function.include.php。
看了如果还不明白的话,我做了以下测试,
情况一:
include("./est.php"); // est.php不存在
echo "
continue...";
?>

测试结果:
Warning: include(./est.php): failed to open stream: No such file or directory in .../test1.php on line 2 Warning: include(): Failed opening './est.php' for inclusion (include_path='.:/usr/local/Cellar/php/5.3.10/lib/php') in .../test1.php on line 2
continue...

情况二:
require("./est.php");
echo "
continue...";
?>

测试结果:
Warning: require(./est.php): failed to open stream: No such file or directory in .../test1.php on line 2 Fatal error: require(): Failed opening required './est.php' (include_path='.:/usr/local/Cellar/php/5.3.10/lib/php') in .../test1.php on line 2
此处continue字符串没有打印出来。
php include 跟 require区别

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。

相关文章

相关视频