php include include_once require require_once 的区别与联系
2016-07-09 23:26
585 查看
一、require 与 include 的区别:
这两个方法基本没有区别,除了在错误处理方面的。如果使用 include 方法出错,这个方法抛出一个warning,不影响程序的继续执行,但是 require 方法产生一个 fatal error,程序运行终止。
二、require 与 require_once 的区别:
这两个方法的区别在于如果使用 require_once php 会检查需要包含的文件是否已经被包含了,如果是,那么就不会重新包含。
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 会检查需要包含的文件是否已经被包含了,如果是,那么就不会重新包含。
相关文章推荐
- 307. Range Sum Query - Mutable
- 当UITableViewCell被选中时,上面的自定义view消失的问题
- 当UITableViewCell被选中时,上面的自定义view消失的问题
- 304. Range Sum Query 2D - Immutable
- 303. Range Sum Query - Immutable
- Java中toString(),(String),valueOf()的区别与联系
- UIPickerView简单实用
- 300. Longest Increasing Subsequence
- 生成器模式(Builder)
- 关于UITableView中Cell的保持/保存 选中状态的简单方法
- hibernate中Query的list和iterator区别(续)
- UINavigationController 的一些坑
- POJ1904 King's Quest(完备匹配可行边:强连通分量)
- [置顶] The requested resource (/) is not available
- UINavigationController改变背景颜色
- LeetCode - 112. Path Sum
- Label设置行间距
- 火眼金睛:continue&break
- UESTC 842 天下归晋(树状数组)
- UESTC 841 休生伤杜景死惊开(树状数组)