Not long after I came into contact with PHP, I came across include and require. I searched online for a long time and many people made comparisons. Some of them were not quite correct and were misleading. The most authoritative and correct answer is here: http://cn. php.net/manual/en/function.include.php.
If you still don’t understand after reading it, I did the following test,
Situation 1:
include("./est.php"); // est.php does not exist
echo "
continue...";
?>
Test results:
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...
Case 2:
require("./est.php");
echo "
continue...";
?>
Test result:
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
The continue string is not printed here.