一、require 与 include 的区别:

The require() function is identical to include(), except that it handles errors differently.
If an error occurs, the include() function generates a warning, but the script will continue execution.
The require() generates a fatal error, and the script will stop.

这两个方法基本没有区别,除了在错误处理方面的。如果使用 include 方法出错,这个方法抛出一个warning,不影响程序的继续执行,但是 require 方法产生一个  fatal error,程序运行终止。

二、require 与 require_once 的区别:

The require_once() statement is identical to require() except PHP will check if the file has already been included,and if so, not include (require) it again.

这两个方法的区别在于如果使用 require_once php 会检查需要包含的文件是否已经被包含了,如果是,那么就不会重新包含。

php include include_once require require_once 的区别与联系的更多相关文章

  1. include,include_once,require,require_once的区别

    1.include() include(/path/to/filename) include()语句将在其被调用的位置处包含一个文件.包含一个文件与在该语句所在位置复制制定文件的数据具有相同内容的效果 ...

  2. php 中使用include、require、include_once、require_once的区别

    在PHP中,我们经常会通过include.require.include_once.require_once来引用文件,都可以达到引用文件的目的,但他们之间又有哪些区别呢,接一下我们详细的介绍一下 i ...

  3. 2018/03/09 每日一学PHP 之 require_once require include include_once 包含文件的区别

    require_once require include include_once 方法的区别 对于包含文件来说,如果只是使用框架来说的话,应该会很少碰到,因为框架底层对于文件的引用等做了很好的封装, ...

  4. PHP中include、require、include_once、require_once的区别

    include:使用include引用外部文件时,只有代码执行到include代码段时,调用的外部文件才会被引用并读取,当引用的文件发生错误时,系统只会给出个警告错误,而整个php文件会继续执行.re ...

  5. 深入掌握include_once与require_once的区别

    转:http://www.jb51.net/article/38587.htm  http://www.360doc.com/content/12/1022/17/7851074_243107406. ...

  6. PHP include()和require()方法的区别

    本文总结了PHP的include()和require()两种包含外部文件的方法的不同之处.基本上就是,加载失败的处理方法,性能,以及使用弹性方面的不同. PHP的include()和require() ...

  7. 转:PHP include()和require()方法的区别

    文章来自于:http://developer.51cto.com/art/200909/153687.htm 本文总结了PHP的include()和require()两种包含外部文件的方法的不同之处. ...

  8. PHP函数include include_once require和require_once的区别

    了解下include.include_once.require和require_once这4个函数: include函数:会将指定的文件读入并且执行里面的程序: require函数:会将目标文件的内容 ...

  9. 【PHP】- include、require、include_once 和 require_once的区别

    1.include:会将指定的档案读入并且执行里面的程序.      被导入的档案中的程序代码都会被执行,而且这些程序在执行的时候会拥有和源文件中呼叫到 include() 函数的位置相同的变量范围( ...

随机推荐

  1. java守护线程(后台线程)

    /*1.让各个对象或类相互灵活交流2.两个线程都冻结了,就不能唤醒了,因为根据代码要一个线程活着才能执行唤醒操作,就像玩木游戏3.中断状态就是冻结状态4.当主线程退出的时候,里面的两个线程都处于冻结状 ...

  2. Where does Windows store MSI files for uninstallation?

    Original link: Where does Windows store MSI files for uninstallation? Following content are only use ...

  3. Poj 1006 / OpenJudge 2977 1006 Biorhythms/生理周期

    1.链接地址: http://poj.org/problem?id=1006 http://bailian.openjudge.cn/practice/2977 2.题目: Biorhythms Ti ...

  4. 关于使用工具类org.apache.commons.collections.ListUtils合并List的问题

    今天在做项目时,需要将几个List进行合并,于是就用到了apache提供关于List操作的工具类ListUtils,但是在使用的过程中发现一些问题. public static void main(S ...

  5. mac下搭建react-native环境

    1.安装Homebrew 2.安装node(最好安装4.x以上版本这样就自带了一个npm) 3.安装npm(node的包管理工具) 一般高版本的npm在安装node的时候已经具有了 4.安装react ...

  6. jquery垂直公告滚动实现代码

    公告滚动想必大家都有见到过吧,实现方法也有很多,下面为大家介绍使用jquery实现垂直公告滚动,感兴趣的朋友不要错过 复制代码代码如下: <!DOCTYPE html PUBLIC " ...

  7. 3.bit-map

    适用范围:可进行数据的快速查找,判重,删除,一般来说数据范围是int的10倍以下 基本原理及要点:使用bit数组来表示某些元素是否存在,比如8位电话号码 扩展:bloom filter可以看做是对bi ...

  8. 一步步学习NHibernate(1)——NHibernate介绍

    请注明转载地址:http://www.cnblogs.com/arhat 第十五章 从本章开始,老魏将给大家一起学习NHibernate这个流行的ORM框架,本来老魏想要和大家一起探讨微软的EF框架的 ...

  9. js Touch事件(向左滑动,后退)

    js Touch事件(向左滑动,后退) 代码如下 var touch_p = { c_x : 0, c_y : 0, hasbacked : false }; function touches(ev) ...

  10. 学无止境,学习AJAX,跨域(三)

    学习AJAX其实有个很重要的应用,就是为了执行另外几个站点的ASP,返回结果. 真正用起来,发现2个问题,>_> 不许笑,一向做DELPHI,接触ASP不多的我,的确问题大堆. 第一个问题 ...