【问题标题】:Protect display contact number保护显示联系人号码
【发布时间】:2016-07-11 10:45:54
【问题描述】:

我有一个分类网站,在页面的产品详细信息中,联系电话显示为普通文本。这些数字在搜索引擎结果中可见。如何保护或如何将电话号码显示为图像以向 SE 隐藏?

【问题讨论】:

  • 数字只是作为位图还是像反向验证码问题一样被破坏?您尝试过的一些代码怎么样,还是处于探索阶段?就目前而言,您需要一个插件或库,这可能会导致在 SO 上关闭问题。谢谢。
  • 数字保存在 mysql 数据库中。我不会像文本一样显示它。

标签: javascript php html twitter-bootstrap


【解决方案1】:

你可以做类似的事情。这会将您的电话号码打印为图像。

<?php
$img = imagecreate(100, 20); //dimension of image

$bg = imagecolorallocate($img, 255, 255, 255); //Give white background
$textcolor = imagecolorallocate($img, 0, 0, 0); //Gives black colour to string. Both follow format in format (image, Red, Green, Blue)
$phone = "1234567890";
imagestring($img, 6, 2, 2, $phone, $textcolor);
// imagestring ( resource $image , int $font , int $x , int $y , string $string , int $color )

// Output the image
header('Content-type: image/png');

imagepng($img); //Outputs a png image
imagedestroy($img); //frees any memory associated with image
?>

【讨论】:

    猜你喜欢
    • 2016-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-18
    • 1970-01-01
    相关资源
    最近更新 更多