【发布时间】:2012-02-10 09:49:10
【问题描述】:
我正在阅读 php here 中 include 和 require 之间的区别。
require will throw a PHP Fatal Error if the file cannot be loaded.
我在 php 中创建了一个测试文件以更好地了解差异,但它们都没有显示任何内容(我在require 中没有看到任何错误)。
请帮帮我。谢谢
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
for( $value = 0; $value < 10; $value++ )
if($value>10)
require("boom.php"); // no such file exits in real
?>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
for( $value = 0; $value < 10; $value++ )
if($value>10)
include("boom.php"); // no such file exits in real
?>
</body>
</html>
【问题讨论】: