【问题标题】:Disabling iPhone Mail to format phone numbers in email禁用 iPhone Mail 以格式化电子邮件中的电话号码
【发布时间】:2020-01-01 11:10:12
【问题描述】:

我需要在 iPhone 的邮件(或其他应用程序)中禁用电话号码识别。

我试过没有成功

<meta name="format-detection" content="telephone=no">

这仅适用于 Safari。

【问题讨论】:

标签: php iphone email


【解决方案1】:

这里提到:

How do you disable phone number linking in iPhone Mail app?

您可以在字符串中添加一些不可见的字符来欺骗识别。

受 Ookep 的回答启发,我在 php 中为此编写了一个函数,经过测试并且可以正常工作:

/**
 * Confusing iPhone Mail or other mail client to not recognize numbers/string
 * as phone numbers
 * 
 * @access public
 * @param  $p_text - the sting/number to obfuscate
 * @return the obfuscated string / false
*/
public static function obfuscate_number_recognition(string $p_text): ?string
{
    // if text provided 
    if (strlen($p_text) > 0) {
        // init vars
        $obfuscated_text = '';
        // looping through the string
        for ($i = 0; $i < strlen($p_text); $i++) {
            // building obfuscated text
            // adding invisible space after every 3rd character
            $obfuscated_text = ($i % 3 == 0)
                ? $obfuscated_text.$p_text[$i].'&#8203;'
                : $obfuscated_text.$p_text[$i];
        } // end for
        return $obfuscated_text;
    } // end if valid param
    return false;
} // end func obfuscate text

【讨论】:

    【解决方案2】:

    正如另一篇文章中提到的,一个简单的答案是在数字中间放置一个零宽度连接符&amp;zwj;。它对我有用。

    【讨论】:

      猜你喜欢
      • 2012-10-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多