is_email
函数
is_email ( $email, $deprecated = false )
- 参数
-
-
(string)
$email
Email address to verify.- Required: 是
-
(bool)
$deprecated
Deprecated.- Required: 否
- Default: false
-
(string)
- 返回值
-
- (string|false) Valid email address on success, false on failure.
- 定义位置
-
-
wp-includes/formatting.php
, line 3467
-
wp-includes/formatting.php
- 引入
- 0.71
- 弃用
- –
Verifies that an email is valid.
Does not grok i18n domains. Not RFC compliant.
function is_email( $email, $deprecated = false ) { if ( ! empty( $deprecated ) ) { _deprecated_argument( __FUNCTION__, '3.0.0' ); } // Test for the minimum length the email can be. if ( strlen( $email ) count( $subs ) ) { /** This filter is documented in wp-includes/formatting.php */ return apply_filters( 'is_email', false, $email, 'domain_no_periods' ); } // Loop through each sub. foreach ( $subs as $sub ) { // Test for leading and trailing hyphens and whitespace. if ( trim( $sub, " tnrx0B-" ) !== $sub ) { /** This filter is documented in wp-includes/formatting.php */ return apply_filters( 'is_email', false, $email, 'sub_hyphen_limits' ); } // Test for invalid characters. if ( ! preg_match( '/^[a-z0-9-]+$/i', $sub ) ) { /** This filter is documented in wp-includes/formatting.php */ return apply_filters( 'is_email', false, $email, 'sub_invalid_chars' ); } } // Congratulations, your email made it! /** This filter is documented in wp-includes/formatting.php */ return apply_filters( 'is_email', $email, $email, null ); }
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。