php簡單驗證碼的制作

f87y 9年前發布 | 755 次閱讀 PHP

<?php
$image=imagecreatetruecolor(100, 30);
$white=imagecolorallocate($image, 255, 255, 2);
$red=imagecolorallocate($image, 255, 0, 0);
imagefill($image, 0, 0, $white);
//munber create
$num="";
for($i=0;$i<5;$i++){

 $num.=rand(1,9);

} imagestring($image, 6, rand(10,20), rand(00,10), $num,imagecolorallocate($image, rand(0,100), rand(100,125), rand(0,255)) ); for($j=0;$j<200;$j++){

 imagesetpixel($image,rand(1,199), rand(1,29), imagecolorallocate($image, 255, 0, 0));

} for($k=0;$k<5;$k++){ imageline($image, rand(1,99), rand(1,29), rand(1,99), rand(1,29), imagecolorallocate($image,0,255, 0)); } header("Content-type:image/png"); imagepng($image); imagedestroy($image); ?></pre>

 本文由用戶 f87y 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!