zoukankan      html  css  js  c++  java
  • php include include_once require require_once 的区别与联系

    一、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 会检查需要包含的文件是否已经被包含了,如果是,那么就不会重新包含。

  • 相关阅读:
    程序打包
    MFC AfxMessageBox默认标题修改
    Json
    agsXMPP
    xmpp
    afxcomctl32.h与afxcomctl32.inl报错
    jQuery使用
    EChart使用
    C++ tinyXML使用
    electron之Windows下使用 html js css 开发桌面应用程序
  • 原文地址:https://www.cnblogs.com/smallrookie/p/5656857.html
Copyright © 2011-2022 走看看