php include 跟 require区别
程序员文章站
2024-01-23 13:51:22
...
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字符串没有打印出来。
相关文章
相关视频
下一篇: 静态方法的访问
推荐阅读
-
[转]细说PHP中strlen跟mb_strlen的区别
-
PHP中require和include路径问题详解
-
php include 跟io流的效率
-
请离开include_once和require_once_PHP教程
-
php中include_once和require_once性能分析
-
PHP str_replace()跟str_ireplace()区别与解释
-
(转)PHP include 跟 require 语句
-
PHP include和require方法的区别
-
php集成环境跟自己配置的区别
-
深入理解require与require_once与include以及include_once的区别