当前位置:Gxlcms > PHP教程 > PHP随机生成n位字符串_PHP教程

PHP随机生成n位字符串_PHP教程

时间:2021-07-01 10:21:17 帮助过:3人阅读

//随机生成n位字符串

function rand_str($num){

$str = "qwertyuioplkjhgfdsazxcvbnmQAZWSXEDCRFVTGBYHNUJMIKOLP1234567890";

$str_len = strlen($str)-1;

//echo $str_len;

$s='';

for ($i = 0; $i < $num; $i++) {

$s.=$str[rand(0, $str_len)];

}

echo $s;

}

rand_str(32);

?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/742405.htmlTechArticle//随机生成n位字符串 functionrand_str($num){ $str = "qwertyuioplkjhgfdsazxcvbnmQAZWSXEDCRFVTGBYHNUJMIKOLP1234567890"; $str_len = strlen($str)-1; //echo $str_len; $s=''; for(...

人气教程排行