php Chinese captcha implementation example sharing

  • 2020-12-13 18:56:07
  • OfStack


<?php
 $text = ' the 1 Can not be a good day, but also from the development of things only do when you want to see the text without open hand 10 Use the main line as before this see the first face of the same 3 Already the old move two long know people's kind now cent outside but the body some with the high intention into the law this realization return 2 The point of the United States on the full work of their voice son to the situation department of the department of justice to ask the force machine to wait for a few of the most new shi Dozen position because of heavy power away 4 The first phase of the east haikou to teach the West again ping true listen to the world gas letter north Shaoguan and the inside of the army by but into the Xianshan 5 Taishui million city eye body elsewhere in the general field teacher book than live 9 smile immediately < / p > < p > zhang Live difficult god a number of pieces of ammeter original car Baiying road period called death often more than the anti - release of the gold system or the division of the light wang Guoqinjie and the Beijing system of the solution of any to clear things like Taiwan to remember the total wind war dry it xu 8 Special jue wang straight MAO Lin Tien Nan Du color word please make love let ';
 $im = imagecreatetruecolor(100,45);
 $font = './msyhbd.ttf';
 $len = mb_strlen($text,'UTF-8');
 $grey = imagecolorallocate($im,200,200,200);
 imagefill($im,0,0,$grey);
 for($i = 0,$x = 0 ;$i < 4 ; $i++ ){
  $color = imagecolorallocate($im,mt_rand(0,190),mt_rand(0,190),mt_rand(0,190));
  $x += $i*10 + mt_rand(1,5);
  $tmp = mb_substr($text,mt_rand(0,$len),1,'UTF-8');
  imagettftext($im,mt_rand(10,16),mt_rand(-15,15),$x,mt_rand(21,25),$color,$font,$tmp);
 }
 header('content-type:image/png');
 imagepng($im);
 imagedestroy($im); 
?>


Related articles: