php include include_once require require_once 的区别与联系
2024-10-09 22:55:38
一、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 会检查需要包含的文件是否已经被包含了,如果是,那么就不会重新包含。
最新文章
- hadoop2.2编程:MRUnit测试
- cocos2dx骨骼动画Armature源码分析(一)
- javascript(定时函数)
- 如何录制手机屏幕并转成gif
- ACM/ICPC 之 DFS求解欧拉通路路径(POJ2337)
- Abap 多线程
- Mac下搭建Eclipse Android开发环境
- HDU 4978 A simple probability problem
- Php 使用 fsockopen发送http请求
- python类继承
- 【踩坑】360安全浏览器“极速模式”和“兼容模式”,套路还是bug?
- Echarts数据可视化series-line线图,开发全解+完美注释
- LeetCode 48. Rotate Image(旋转图像)
- c语言的流程控制
- 剑指Offer——中国银行面试知识储备
- php封装curl,模拟POST和GET请求HTTPS请求
- gh-ost的延迟控制机制
- 使用NodeJs搭建的小型web应用
- 洛谷P1503 鬼子进村 [平衡树,STL]
- 编写第一个Shell脚本