首页 WordPress函数大全 esc_url()

esc_url()

2020-05-01 / 3917阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

esc_url( string $url, string[] $protocols = null, string $_context = 'display' )

Checks and cleans a URL.

描述

A number of characters are removed from the URL. If the URL is for displaying (the default behaviour) ampersands are also replaced. The ‘clean_url’ filter is applied to the returned cleaned URL.

参数

$url

(string)
(Required)
The URL to be cleaned.

$protocols

(string[])
(Optional)
An array of acceptable protocols. Defaults to return value of wp_allowed_protocols()

Default value: null

$_context

(string)
(Optional)
Private. Use esc_url_raw() for database usage.

Default value: 'display'

返回

(string) The cleaned $url after the 'clean_url' filter is applied.

大家谈论
    我的见解