我正在读你的书,开始php和mysql,我发现一个错误。第3章,第111页:
For instance, if require() is placed within an
if statement that evaluates to false, the file would be included anyway.
但我用我的代码测试了这一点。这不是真的。b.php
<?php
if(false)
{
require "a.php";
}
?>
a.php
<?php
echo "this is a.php<br>"
?>
我运行了b.php。页面上没有任何内容。
我的php版本是5.4.7。那么这本书说错了吗?
正如我们所看到的,if
语句在布尔参数上工作,因为条件应该声明TRUE
或FALSE
,如果它已经为false,那么它将转到语句的其他部分。
这里的清晰之处在于包括了File,但由于if(false)
,将不会显示任何结果。