This article mainly introduces in detail the use of crypt() function for encryption in PHP, which has certain reference value. Interested friends can refer to it
1. Code
加密后$str的值为:'.$crypttostr; //输出加密后的变量 ?>
2. Running results
Parameters without salt are encrypted each time The resulting ciphertexts are all different.
The value of $str before encryption is: apply the crypt() function for one-way encryption!
The value of $str after encryption is: $1$Re4.Gg4.$D.yd00xX0fFfIfp6KrKGN0
3. Code
使用crypt函数进行数据验证
0){ echo "用户登录成功。"; }else{ echo "用户登录失败!"; } }else{ echo "请认真填写用户名和密码!"; } ?> | ||
4. Running results
Related recommendations:
PHP’s more secure password encryption mechanism BcryptDetailed graphic explanation
PHP password encryption mechanism BcryptDetailed explanation
The above is the detailed content of How to use crypt() function for encryption in php. For more information, please follow other related articles on the PHP Chinese website!