Home >Backend Development >PHP Tutorial >Sharing the development process of generating random passwords in PHP
In our daily development work, we often need to generate passwords. Using PHP to develop applications, especially website programs, often requires generating random passwords. For example, a random password is generated for user registration, and a user also needs to generate a password to reset his password. Random password, today I will introduce to you PHP to generate a random password, including uppercase and lowercase letters, Arabic numerals, special characters, password length, use additional special characters, and generate a random password from the character column.
First download the PHP random password generation library we need to use for this course: http://www.php.cn/xiazai/leiku/498
Find us after the download is complete Unzip the required php class files to our local directory and create a new php file!
After completion, we need to call this class in the new php file and instantiate the class:
<?php include_once "password.php";//引入类文件 $obj = new Password; //实例化 //获取随机密码 echo $obj->generate(); echo $obj->random(); ?>
Note: The result page display of this run will be blank:
Note:
Every time the page is refreshed, you will get a different password!
The above is the detailed content of Sharing the development process of generating random passwords in PHP. For more information, please follow other related articles on the PHP Chinese website!