Skip to content

Instantly share code, notes, and snippets.

@zsmynl
Created February 14, 2014 03:50
Show Gist options
  • Save zsmynl/8995453 to your computer and use it in GitHub Desktop.
Save zsmynl/8995453 to your computer and use it in GitHub Desktop.
php简单的声称随机字符串/
<?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