search
Homephp教程php手册php自定义函数:生成新密码函数

php自定义函数:生成新密码函数

Jun 13, 2016 am 10:39 AM
functionphpfunctionpasswordgeneratecustomize

  1. //php生成新密码函数
  2. function genPassword($min = 5, $max = 8)   
  3. {   
  4.     $validchars="abcdefghijklmnopqrstuvwxyz123456789";   
  5.     $max_char=strlen($validchars)-1;   
  6.     $length=mt_rand($min,$max);   
  7.     $password = "";   
  8. for($i=0;$i
  9. {   
  10.     $password.=$validchars[mt_rand(0,$max_char)];   
  11. }   
  12.     return $password;   
  13. }   
  14. echo "新密码:".genPassword()."
    ";   
  15. echo "新密码:".genPassword(5,10)."
    ";
  16. ?>
Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!