函数文档

send_nosniff_header()

💡 云策文档标注

概述

send_nosniff_header() 函数用于发送 HTTP 头以禁用浏览器中的内容类型嗅探,适用于支持此功能的浏览器。

关键要点

  • 函数发送 X-Content-Type-Options: nosniff 头,防止浏览器进行 MIME 类型嗅探,增强安全性。
  • 此功能自 WordPress 3.0.0 版本引入,适用于所有后续版本。
  • 相关参考链接提供了关于此安全特性的背景信息,如 IE 和 Chrome 浏览器的实现细节。

代码示例

function send_nosniff_header() {
	header( 'X-Content-Type-Options: nosniff' );
}

📄 原文内容

Sends a HTTP header to disable content type sniffing in browsers which support it.

Description

See also

Source

function send_nosniff_header() {
	header( 'X-Content-Type-Options: nosniff' );
}

Changelog

Version Description
3.0.0 Introduced.