php require条件引用有关问题

WBOY
Release: 2016-06-13 12:16:43
Original
957 people have browsed it

php require条件引用问题
网上看到这么一段话
include()与require()的功能相同,用法上却有一些不同,include()是有条件包含函数,而require()则是无条件包含函数。
无论$something取何值,下面的代码将把文件somefile.php包含进文件里:

if($something){<br />  require 'somefile.php';<br />}
Copy after login

但在我实际测试中,条件为假时是不包含的。

是因为环境不同,还是另有原因,请大家指教
------解决思路----------------------
你看到的是针对 php4 的介绍
在 php5 中,无论是 require 还是 include 都在预编译时进行加载(不用时看不见) 
两者的区别仅限于前者出错时会中断程序,而后者不会

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template