產生圖片隨機字串
產生圖片隨機字串
发布时间:2016-12-29 来源:查字典编辑
摘要:

<?php

$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<$words;$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);

?>

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新php教程学习
热门php教程学习
编程开发子分类