检查密码是否等于用户密码 Laravel 7

checking if password is equals user password Laravel 7

我有这个代码

<form action="form.php" method="post">
    <input type="password" name="password">
    <input type="submit" name="submit">
</form>

@isset($_POST['submit'])
    @if(password==user password or sth like that)
        <p>the pasword is correct</p>
@else
    <p>the pasword is wrong</p>
    @endif
  @endisset

我需要在 @if(password==user password or sth like that) 中输入什么才能使用密码检查?

如果您想在 laravel 上执行此操作,请查看此 link 。你应该在控制器上做这个控制。

但是如果你想在 form.php 上这样做,那么首先连接你的数据库并像这样检查它

if($_POST['password'] == $user_password_from_database) 

还要注意哈希函数。如果您使用任何哈希函数保存了密码,那么您应该对它们进行解码。祝你好运