randVerify.php是用来做什么的?

更新于
2026-09-24 16:53:33
1阅读来源:SEO资源
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计155个文字,预计阅读时间需要1分钟。

randVerify.php是用来做什么的?

phprandVerify.php: 生成随机验证码@param integer $codeLength: 随机验证码长度@param string $onlyNumber: 默认为只获取数字@return numberfunction randVerify($codeLength, $onlyNumber=TRUE) { if ($onlyNumber==TRUE) { $characters='0123456789'; } else { $characters='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; } $charactersLength=strlen($characters); $randomString=''; for ($i=0; $i < $codeLength; $i++) { $randomString .=$characters[rand(0, $charactersLength - 1)]; } return $randomString;}

randVerify.php

/** * 生成随机验证码 * @param integer $codeLenth:随机验证码长度 * @param string $onlyNumber:默认为只获取数字 * @return number */ function randVerify($codeLenth,$onlyNumber=TRUE) { if ($onlyNumber == TRUE){ $code = ''; for($i = 1 ; $i <=$codeLenth ; $i++){ $code .= rand(0,9); } return $code; } $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz'; $string=time(); $len = 11; for(;$len>=1;$len--) { $position=rand()%strlen($chars); $position2=rand()%strlen($string); $string=substr_replace($string,substr($chars,$position,1),$position2,0); } return substr($string, 0 , $codeLenth); }

randVerify.php是用来做什么的?
标签:randVerifyphp

本文共计155个文字,预计阅读时间需要1分钟。

randVerify.php是用来做什么的?

phprandVerify.php: 生成随机验证码@param integer $codeLength: 随机验证码长度@param string $onlyNumber: 默认为只获取数字@return numberfunction randVerify($codeLength, $onlyNumber=TRUE) { if ($onlyNumber==TRUE) { $characters='0123456789'; } else { $characters='0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; } $charactersLength=strlen($characters); $randomString=''; for ($i=0; $i < $codeLength; $i++) { $randomString .=$characters[rand(0, $charactersLength - 1)]; } return $randomString;}

randVerify.php

/** * 生成随机验证码 * @param integer $codeLenth:随机验证码长度 * @param string $onlyNumber:默认为只获取数字 * @return number */ function randVerify($codeLenth,$onlyNumber=TRUE) { if ($onlyNumber == TRUE){ $code = ''; for($i = 1 ; $i <=$codeLenth ; $i++){ $code .= rand(0,9); } return $code; } $chars='ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz'; $string=time(); $len = 11; for(;$len>=1;$len--) { $position=rand()%strlen($chars); $position2=rand()%strlen($string); $string=substr_replace($string,substr($chars,$position,1),$position2,0); } return substr($string, 0 , $codeLenth); }

randVerify.php是用来做什么的?
标签:randVerifyphp