标签:span 计算 参数 tab php str class rand out
$chars_array = array( $arr=array_merge(range(0,9),range(‘a‘,‘z‘),range(‘A‘,‘Z‘)); #原数组
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"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", "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",
);
//count计算
$charsLen = count($chars_array) - 1; // 计算出上面数组的长度
$outputstr = "";
// 第二个参数 代表生成四个随机数
for ($i=0; $i<4; $i++)
{
$outputstr .= $chars_array[mt_rand(0, $charsLen)];
}
echo $outputstr;
标签:span 计算 参数 tab php str class rand out
原文地址:http://www.cnblogs.com/TMDD/p/6092183.html