大网数据广告活动
PHP 语言与运行手册

libxml_disable_entity_loader · Disable the ability to load external entities

· 52CE 我爱测

libxml_disable_entity_loader — Disable the ability to load external entities

libxml_disable_entity_loader

(PHP 5 >= 5.2.11, PHP 7, PHP 8)

libxml_disable_entity_loader — Disable the ability to load external entities

警告

本函数已自 PHP 8.0.0 起被废弃。强烈建议不要依赖本函数。

说明

#[\Deprecated(
    since: '8.0',
    message: 'as external entity loading is disabled by default',
)]

function libxml_disable_entity_loader(bool $disable = true): bool

Disable/enable the ability to load external entities. Note that disabling the loading of external entities may cause general issues with loading XML documents.

As of libxml 2.9.0 entity substitution is disabled by default, so there is no need to disable the loading of external entities, unless there is the need to resolve internal entity references with LIBXML_NOENT, LIBXML_DTDVALID, or LIBXML_DTDLOAD. Generally, it is preferable to use libxml_set_external_entity_loader() to suppress loading of external entities. The LIBXML_NO_XXE constant can be used to prevent this as well (only available in Libxml >= 2.13.0, as of PHP 8.4.0).

参数

disable

Disable (true) or enable (false) libxml extensions (such as DOM, XMLWriter and XMLReader) to load external entities.

返回值

Returns the previous value.

更新日志

版本 说明
8.0.0 This function has been deprecated.

参见

来源:PHP Documentation Group · 作者与贡献记录 · CC BY 3.0。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
PHP Documentation Group
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。