public function verify()
{
//生产验证码值
$char_list = '1234567890';//所有可能的字符
$list_lenght = strlen($char_list);
$code_lenght = 6;//码值长度
$verify = '';
for ($i = 1; $i <= $code_lenght; ++$i) {
$rend_index = mt_rand(0, $list_lenght - 1);
$verify .= $char_list[$rend_index];//
}
return $verify;
}
网友评论