20c02-1.php

来自「介绍PHP5的给类型函数应用」· PHP 代码 · 共 19 行

PHP
19
字号
<?php// Assume that we have been given the following password:$password = 'bob123xy';// Now encrypt this password, we will not provide the optional second// parameter to specify a 'salt' or 'seed' for the encryption, since the// specifics can vary per system, easiest to leave it blank.$enc = crypt($password);// Now, let's assume that we've just been given a password as part of a login// Let's try to recrypt it to match.  This time pass the encrypted version as// the 'salt' so that it can generate it again.  The original salt is saved // as part of the encryption process. -- This should echo GOOD.if (crypt($password, $enc) == $enc) {	echo 'GOOD';} else {	echo 'FAILED';}?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?