require和include与php有什么区别? [英] What is the difference between require and include with php?

查看:89
本文介绍了require和include与php有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道何时应该使用 include require 以及每个人的优势。

I want to know when I should use include or require and what's the advantage of each one.

推荐答案

要求 要求, include 包括。

根据手册:


require()与include()相同,除非失败,否则会产生致命的E_ERROR级别错误。换句话说,它将暂停脚本,而include()仅发出警告(E_WARNING),允许脚本继续。

require() is identical to include() except upon failure it will produce a fatal E_ERROR level error. In other words, it will halt the script whereas include() only emits a warning (E_WARNING) which allows the script to continue.

这篇关于require和include与php有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆