Home > php教程 > php手册 > 随机生成含大小写字母、数字的字符串

随机生成含大小写字母、数字的字符串

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 11:34:38
Original
1642 people have browsed it

随机生成含有大小写字母,数字的字符串。可以修改定制。
$str = null;<br> $num = 10;// 字符串长度<br> $strPol = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";//如果不需要小写字母,可以把小写字母都删除<br> $max = strlen($strPol)-1;<br> <br> for($i=0;$i     $str.=$strPol[rand(0,$max)];//rand($min,$max)生成介于min和max两个数之间的一个随机整数<br> }<br> echo $str;

AD:真正免费,域名+虚机+企业邮箱=0元

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template