【问题标题】:POST responses are null()POST 响应为 null()
【发布时间】:2019-09-15 18:04:40
【问题描述】:

我已经重做了一百万种方法,但找不到它为什么无效

省略 md5 哈希并将其置于内联 将字符串直接传递给函数

login_view.php

<form class="form-signin" action="<?php echo site_url('login/auth'); ?>" method="post">
       <h2 class="form-signin-heading">Please sign in</h2>
       <?php echo $this->session->flashdata('msg');?>
       <label for="username" class="sr-only">Username</label>
       <input type="email" name="email" class="form-control" placeholder="Email" required autofocus>
       <label for="password" class="sr-only">Password</label>
       <input type="password" name="password" class="form-control" placeholder="Password" required>
       <div class="checkbox">
         <label>
           <input type="checkbox" value="remember-me"> Remember me
         </label>
       </div>
       <button class="btn btn-lg btn-primary btn-block" type="submit" >Sign in</button>
     </form>

登录.php

function auth(){
$email    = $this->input-> post('email');
$password = $this->input-> post('password');
$validate = $this->login_model->validate($email,$password);

无法正常检索 POST 项目

【问题讨论】:

  • "省略 md5 哈希" 请勿使用 MD5 进行密码哈希。 这是非常不安全的。使用php.net/password_hashphp.net/password_verify
  • 您确定正在联系login/auth 吗?您如何确定输入没有被检索到?

标签: php html codeigniter-3


【解决方案1】:

尝试在这样的 URL 后添加斜杠

<form class="form-signin" action="<?php echo site_url('login/auth/'); ?>" method="post">

如果您仍有问题,请查看this

【讨论】:

    【解决方案2】:

    我猜是你使用的site_url,应该是base_url()

    根据documentationsite_url 返回的索引文件似乎不是您需要的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-03
      • 1970-01-01
      • 2017-08-06
      • 2018-05-23
      相关资源
      最近更新 更多