时间:2021-07-01 10:21:17 帮助过:4人阅读
function get_number($table,$filed){ if(!isset($table) || !isset($filed)){ return ''; } if(trim($table)=='' || trim($filed)==''){ return ''; } global $db; $user_number=str_shuffle(substr(randomname(-5),11)); $sql="select `id` from `".$table."` where `".$filed."`='".$user_number."'"; if($db->getRowsNum($sql) || strpos($user_number,'0')==0){ get_number($table,$filed); } return $user_number; } /***********生成随机数[随机数是后五位,一共是19位]****************/ function randomname($start,$len=''){ if(!isset($start) || !is_numeric($start) || ($len!='' && !is_numeric($len))){ return ''; }echo '-----'; $seedstr=explode(' ',microtime(),5); $seed=$seedstr[0]*10000; $random=date('YmdHis', time()).rand(10000,100000); return $len===''?substr($random,$start):substr($random,$start,$len); }
http://www.bkjia.com/PHPjc/764176.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/764176.htmlTechArticle自己用php写的生成会员账号功能,仅供参考,代码如下: function get_number($table,$filed){if(!isset($table) || !isset($filed)){return '';}if(trim($table)=='' |...