保护显示联系号码

时间:2016-07-11 10:45:54

标签: javascript php html5 twitter-bootstrap

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

1 个答案:

答案 0 :(得分:0)

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

<?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
?>