页面导航: 首页网络编程PHP编程php实例 → 正文内容

產生圖片隨機字串

发布:dxy 字体:[增加 减小] 类型:转载
<?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);  
?>
浏览次数:载入中... 打印本文关闭本文返回首页
·在百度中搜索关于“產生圖片隨機字串”相关内容
·在谷歌中搜索关于“產生圖片隨機字串”相关内容

文章评论

共有 位脚本之家网友发表了评论我来说两句

同 类 文 章
最 近 更 新
热 点 排 行