產(chǎn)生圖片隨機(jī)字串
更新時(shí)間:2006年12月06日 00:00:00 作者:
<?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);
?>
$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);
?>
相關(guān)文章
PHP 年月日的三級(jí)聯(lián)動(dòng)實(shí)例代碼
這篇文章主要介紹了PHP 年月日的三級(jí)聯(lián)動(dòng)實(shí)例代碼的相關(guān)資料,需要的朋友可以參考下2017-05-05
支付寶接口開發(fā)集成支付環(huán)境小結(jié)
本文主要給大家分享的是在做支付寶接口開發(fā)集成支付環(huán)境的全過(guò)程,非常的詳細(xì),搭配示例代碼,是篇非常不錯(cuò)的文章,這里推薦給大家,有需要的小伙伴參考下。2015-03-03
php導(dǎo)出csv數(shù)據(jù)在瀏覽器中輸出提供下載或保存到文件的示例
這篇文章主要介紹了php導(dǎo)出csv數(shù)據(jù)在瀏覽器中輸出提供下載或保存到文件的示例,需要的朋友可以參考下2014-04-04
LAMP環(huán)境使用Composer安裝Laravel的方法
這篇文章主要介紹了LAMP環(huán)境使用Composer安裝Laravel的方法,簡(jiǎn)單分析了Ubuntu服務(wù)器環(huán)境下Composer的安裝及使用Composer安裝Laravel的相關(guān)命令與使用技巧,需要的朋友可以參考下2017-03-03
thinkPHP3.2使用RBAC實(shí)現(xiàn)權(quán)限管理的實(shí)現(xiàn)
這篇文章主要介紹了thinkPHP3.2使用RBAC實(shí)現(xiàn)權(quán)限管理的實(shí)現(xiàn),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-08-08

