我想让这个脚本中的 ImageString(生成验证码)返回 5 位数字验证码加上文本“是代码”(以帮助混淆垃圾邮件机器人)。我将在哪里修改此代码以在生成的图像中包含我的自定义文本?
感谢您对此的任何帮助。
<?php
session_start();
$md5_hash = md5(rand(0,99999));
$security_code = substr($md5_hash, 25, 5);
$enc = md5($security_code);
$_SESSION['captcha'] = $enc;
$width = 165;
$height = 30;
$image = ImageCreate($width, $height);
$white = ImageColorAllocate($image, 255, 255, 255);
$black = ImageColorAllocate($image, 0, 0, 0);
$grey = ImageColorAllocate($image, 200, 200, 200);
ImageFill($image, 0, 0, $white);
ImageString($image, 10, 7, 7, $security_code, $black);
header("Content-Type: image/png");
ImagePng($image);
ImageDestroy($image);
?>