PHP生成随机数

//验证码的随机数

<?php

$arr = array(
'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x',
'y','z','0','1','2','3','4','5','6','7','8','9'
);
$rand = "";
for($i=1;$i<=4; $i++){
$rand .= $arr[rand(0,count($arr)-1)];
}

显示的4个随机数字和字母

echo $rand;

?>

posted @ 2014-05-13 21:02  天外小龙虾  阅读(196)  评论(0编辑  收藏  举报