首页  >  文章  >  后端开发  >  產生圖片隨機字串_PHP教程

產生圖片隨機字串_PHP教程

WBOY
WBOY原创
2016-07-21 15:58:44947浏览

$base = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';  
$words = 5;  
$rand_top = strlen($base) - 1;  
$string = '';  
header("Content-type: image/png");  
$im = imagecreate($words*16, $words*5);  
$black = imagecolorallocate($im, 90, 60, 120);  
$white = imagecolorallocate($im, 255, 255, 255);  
for($i=0;$i  $idx = mt_rand(0, $rand_top);  
  imagestring($im, 3, $i*15+2, mt_rand(0, $words*2), $base[$idx], $white);  
}  
imagepng($im);  
imagedestroy($im);  
?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/317488.htmlTechArticle?php $base='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; $words=5; $rand_top=strlen($base)-1; $string=''; header("Content-type:image/png"); $im=imagecreate($word...
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn