sanitize_url

函数
sanitize_url ( $url, $protocols = null )
参数
  • (string) $url The URL to be cleaned.
    Required:
  • (string[]) $protocols Optional. An array of acceptable protocols. Defaults to return value of wp_allowed_protocols().
    Required:
    Default: null
返回值
  • (string) The cleaned URL after esc_url() is run with the 'db' context.
相关
  • esc_url()
定义位置
相关方法
sanitize_usersanitize_termsite_urlsanitize_emailsanitize_user_field
引入
2.3.1
弃用
-

sanitize_url: 这是一个WordPress的函数,可以对一个URL进行净化。它用于删除任何潜在的危险元素,如脚本标签或无效字符: 这个函数有一个参数,就是要净化的URL。

为数据库或重定向使用的URL进行净化处理。

function sanitize_url( $url, $protocols = null ) {
	return esc_url( $url, $protocols, 'db' );
}

常见问题

FAQs
查看更多 >
闪电伯伯

(工作日 10:00 - 18:30 为您服务)

2025-11-19 00:27:39

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: