最新消息: 新版网站上线了!!!

php生成打码的图片

  1. <?php 
  2. // Requires the GD Library 
  3. header("Content-type: image/png"); 
  4. $im = imagecreatetruecolor(512, 512) 
  5.     or die("Cannot Initialize new GD image stream"); 
  6. $white = imagecolorallocate($im, 255, 255, 255); 
  7. for ($y = 0; $y < 512; $y++) { 
  8.     for ($x = 0; $x < 512; $x++) { 
  9.         if (rand(0, 1)) { 
  10.             imagesetpixel($im$x$y$white); 
  11.         } 
  12.     } 
  13. }        
  14. imagepng($im); 
  15. imagedestroy($im); 

 

转载请注明:谷谷点程序 » php生成打码的图片