【发布时间】:2020-01-01 11:10:12
【问题描述】:
我需要在 iPhone 的邮件(或其他应用程序)中禁用电话号码识别。
我试过没有成功
<meta name="format-detection" content="telephone=no">
这仅适用于 Safari。
【问题讨论】:
-
是的,也许如果我将该函数转换为 php,那么它将起作用。这是一个 7 年前的答案,所以我需要对其进行测试。
我需要在 iPhone 的邮件(或其他应用程序)中禁用电话号码识别。
我试过没有成功
<meta name="format-detection" content="telephone=no">
这仅适用于 Safari。
【问题讨论】:
这里提到:
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].'​'
: $obfuscated_text.$p_text[$i];
} // end for
return $obfuscated_text;
} // end if valid param
return false;
} // end func obfuscate text
【讨论】:
正如另一篇文章中提到的,一个简单的答案是在数字中间放置一个零宽度连接符&zwj;。它对我有用。
【讨论】: