Home > php教程 > php手册 > body text

include()与require()的对比

WBOY
Release: 2016-06-13 10:37:56
Original
724 people have browsed it

php的require()性能与include()相类似。不同之处在于,对include()来说,在include()执行时文件每次都要进行读取和评估;而对于require()来说,文件只处理一次(实际上,文件内容替换了require()语句)。这就意味着如果有包含这些指令之一的代码和可能执行多次的代码,则使用require()效率比较高。另一方面,如果每次执行代码时相读取不同的文件,或者有通过一组文件叠代的循环,就使用include(),因为可以给想要包括的文件名设置一个变量,当参数为include()时使用这个变量。

原作者:不详  
来源:mysql指南   


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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template