Created
February 14, 2014 03:50
-
-
Save zsmynl/8995453 to your computer and use it in GitHub Desktop.
php简单的声称随机字符串/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* 生成随机字母与数字混合验证码 */ | |
function randomkeys($length) { | |
$returnStr=''; | |
$pattern='23456789abcdefghijkmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ'; | |
for($i=0;$i<$length;$i ++) { | |
$returnStr.=$pattern{mt_rand(0,strlen($pattern)-1)}; //生成php随机数 | |
} | |
return $returnStr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment