$pass = $db->real_escape_string($_POST['pass']); if (empty($pass)) { die("密碼為必填!"); } $pass = password_hash($pass, PASSWORD_DEFAULT); ``` 二、測試 1. password\_hash.php ``` "; echo $hash; echo ""; if (password_verify($pwd, $hash)) { //判斷密碼 echo "密碼正確(hash)"; } echo ""; echo "------------------ md5 -----------------"; echo ""; echo $md5; ```
"; echo $hash; echo ""; if (password_verify($pwd, $hash)) { //判斷密碼 echo "密碼正確(hash)"; } echo ""; echo "------------------ md5 -----------------"; echo ""; echo $md5; ```