|
发表于 2012-10-10 23:46:56
|
显示全部楼层
给楼主补充一下,楼主说明的太简单了
本帖最后由 popuppp 于 2012-10-10 23:53 编辑
修改方法,将/source/function中的function_core.php- function random($length, $numeric = 0) {
- $seed = base_convert(md5(microtime().$_SERVER['DOCUMENT_ROOT']), 16, $numeric ? 10 : 35);
- $seed = $numeric ? (str_replace('0', '', $seed).'012340567890') : ($seed.'zZ'.strtoupper($seed));
- $hash = '';
- $max = strlen($seed) - 1;
- for($i = 0; $i < $length; $i++) {
- $hash .= $seed{mt_rand(0, $max)};
- }
- return $hash;
- }
复制代码 修改为- function random($length, $numeric = 0) {
- $seed = base_convert(md5(microtime().$_SERVER['DOCUMENT_ROOT']), 16, $numeric ? 10 : 35);
- $seed = $numeric ? (str_replace('0', '', $seed).'012340567890') : ($seed.'zZ'.strtoupper($seed));
- if($numeric) {
- $hash = '';
- } else {
- $hash = chr(rand(1, 26) + rand(0, 1) * 32 + 64);
- $length--;
- }
- $max = strlen($seed) - 1;
- for($i = 0; $i < $length; $i++) {
- $hash .= $seed{mt_rand(0, $max)};
- }
- return $hash;
- }
复制代码 |
|