antispambot()

antispambot()函数是Wordpress函数,将电子邮件地址字符转换为HTML实体以阻止垃圾邮件机器人程序。

antispambot( string $email_address, int $hex_encoding )

参数(Parameters)

参数类型必填说明
$email_address(string)必需电子邮件地址。
$hex_encoding(int)可选设置为1以启用十六进制编码。

返回(Return)

(string)转换的电子邮件地址。


源码(Source)

/**
 * Converts email addresses characters to HTML entities to block spam bots.
 *
 * @since 0.71
 *
 * @param string $email_address Email address.
 * @param int    $hex_encoding  Optional. Set to 1 to enable hex encoding.
 * @return string Converted email address.
 */
function antispambot( $email_address, $hex_encoding = 0 ) {
	$email_no_spam_address = '';
	for ( $i = 0, $len = strlen( $email_address ); $i < $len;="" $i++="" )="" {="" $j="rand(" 0,="" 1="" +="" $hex_encoding="" );="" if="" (="" $j="=" 0="" )="" {="" $email_no_spam_address="" .='&#' .="" ord(="" $email_address[$i]="" )="" .="" ';';="" }="" elseif="" (="" $j="=" 1="" )="" {="" $email_no_spam_address="" .="$email_address[$i];" }="" elseif="" (="" $j="=" 2="" )="" {="" $email_no_spam_address="" .='%' .="" zeroise(="" dechex(="" ord(="" $email_address[$i]="" )="" ),="" 2="" );="" }="" }="" return="" str_replace(="" '@',="" '@',="" $email_no_spam_address="" );="" }="">
更新版本源码位置使用被使用
0.71wp-includes/formatting.php:279201 function

笔记(Notes)

例子

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索