Home  >  Article  >  Backend Development  >  Sharing the development process of generating random passwords in PHP

Sharing the development process of generating random passwords in PHP

黄舟
黄舟Original
2017-08-18 09:49:361379browse

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:

Sharing the development process of generating random passwords in PHP

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!

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