產生圖片隨機字串

所属分类: 网络编程 / PHP编程 阅读数: 835
收藏 0 赞 0 分享
<?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);  
?>
更多精彩内容其他人还在看

產生圖片隨機字串

產生圖片隨機字串
收藏 0 赞 0 分享

数字转英文

数字转英文
收藏 0 赞 0 分享

ajax缓存问题解决途径

ajax缓存问题解决途径
收藏 0 赞 0 分享

PHP字符函数大全第1/2页

PHP字符函数大全
收藏 0 赞 0 分享

从网上搜到的phpwind 0day的代码

从网上搜到的phpwind 0day的代码
收藏 0 赞 0 分享

IIS下配置Php+Mysql+zend的图文教程

IIS下配置Php+Mysql+zend的图文教程
收藏 0 赞 0 分享

如何写php程序?

如何写php程序?
收藏 0 赞 0 分享

php中处理模拟rewrite 效果

php中处理模拟rewrite 效果
收藏 0 赞 0 分享

用PHP函数解决SQL injection

用PHP函数解决SQL injection
收藏 0 赞 0 分享

粗略计算在线时间,bug:ip相同

粗略计算在线时间,bug:ip相同
收藏 0 赞 0 分享
查看更多