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, 在网上查了很久,很多人也做了比较,有些不大正确,有误导之嫌,最权威的正确的答案在这里: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字符串没有打印出来。
相关文章
相关视频
上一篇: mysql与oracle的区别
下一篇:
推荐阅读
-
php中require和require_once的区别说明
-
深入理解require与require_once与include以及include_once的区别
-
PHP包含文件函数include、include_once、require、require_once区别总结
-
php use和include区别总结
-
PHP中include与require使用方法区别详解
-
php include和require的区别深入解析
-
PHP中require和include路径问题详解
-
php 文件包含 include、include_once、require、require_once
-
php中require和require_once的区别说明
-
php echo()和print()、require()和include()函数区别说明