<?php
session_start();
$arrChar = array_merge(range(0,9),range('a','z'),range('A','Z'));
$len = 5;
$min = 0;
$max = count($arrChar)-1;
$text = '';
for($i = 1;$i <= 5;$i++){
$a = rand($min,$max);
$arr = $arrChar[$a];
$text.=$arr;
}
$imgHeightMin = 0;
$imgHeightMax = 59;
$imgWidth = 199;
$imgHeight = 59;
$img = imagecreatetruecolor(200,60);
$imageColor = imagecolorallocate($img,200,200,200);
imagefill($img,0,0,$imageColor);
for($c = 1;$c <= $len;$c++) {
$x = $imgWidth/$len*($c-1)+3;
$y = rand(30,50);
$textColor = imagecolorallocate($img, rand(0, 255), rand(0, 255), rand(0, 255));
imagettftext($img, 20, 0, $x, $y, $textColor, __DIR__ . '/6.ttf', $text[$c-1]);
}
for($j = 1;$j <= 100;$j++) {
$pixelColor = imagecolorallocate($img,rand(0,255),rand(0,255),rand(0,255));
imagesetpixel($img, rand(0, 199), rand(0, 59), $pixelColor);
}
for($k = 1;$k <= 10;$k++) {
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余1页未读,立即下载