header("content-type:image/png");
$num = $_GET['num'];
$imagewidth=60;
$imageheight=18;
srand(microtime() * 100000);
$numimage = imagecreate($imagewidth,$imageheight);
imagecolorallocate($numimage,183,180,83);
for($i=0;$i
$font = mt_rand(3,5);
$x = mt_rand(1,8)+$imagewidth*$i/4;
$y = mt_rand(1,$imageheight/3);
$color=imagecolorallocate($numimage,mt_rand(0,50),mt_rand(0,150),mt_rand(0,255));
imagestring($numimage,$font,$x,$y,$num[$i],$color);
}
imagepng($numimage);
imagedestroy($numimage);
?>
调用方法:
session_start();
include_once 'conn/conn.php';
$pattern = '1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLOMNOPQRSTUVWXYZ';
$num = null;
for($i = 0; $i < 4; $i++) {
$num .= $pattern{mt_rand(0, 61)};
}
?>
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点!
本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。