【问题标题】:My Laravel Auth::attempt Is Work localhost but on my website not logged我的 Laravel Auth::attempt 在本地工作,但在我的网站上没有记录
【发布时间】:2015-01-19 00:31:28
【问题描述】:

嘿,所有程序员,我有一个大问题 我的本地主机 xampp 上有一个项目 我的 Auth::attempt 是我本地主机的工作 但是在上传我的网站之前不起作用 我从 app.php 更改我的密钥生成 并从控制器登录测试所有代码 这是我的代码登录电子邮件,密码可从用户模型中填写 我添加了受模型用户保护的主键 我检查我的 Auth.php 是好的

这是我的尝试代码

public function PostLogin()
{
    $inputs = Input::all();
    $rules  = array('email'=>'required|email','pass'=>'required');
    $valid = Validator::make($inputs,$rules);

    if($valid->fails())
    {
        return Redirect::to('login')->withErrors($valid);
    }else{
        $crec = array('email'=>$inputs['email'],'password'=>Input::get('pass'));
      if(Auth::attempt($crec))
      {
        return Redirect::to('/');
      }else{
        return View::make('users.login')->with('title',Lang::get('users.login'));
      }

    }
}

/============================================ ====/

protected $fillable  = array('email','username','password');
protected $primaryKey = "id";

/**
 * The database table used by the model.
 *
 * @var string
 */
protected $table = 'users';

/**
 * The attributes excluded from the model's JSON form.
 *
 * @var array
 */
protected $hidden = array('password', 'remember_token');

}

======================

请帮忙,谢谢

【问题讨论】:

    标签: php authentication laravel


    【解决方案1】:

    确保您使用正确的类型和链接以及/app/config/database.php 中的凭据连接到在线数据库,并确保从链接中删除http://。

    【讨论】:

    • 你说它在本地主机上工作,但它在托管服务器上不在线。你说的是这个吗?
    • 是的,我这么说,但我确定连接数据库并且我有一个注册新用户页面是工作但我想知道这个错误怎么办而不是登录我的网站但登录本地主机是工作
    猜你喜欢
    • 2015-04-01
    • 2019-03-16
    • 2017-03-10
    • 1970-01-01
    • 2014-06-20
    • 1970-01-01
    • 2022-11-12
    • 2021-01-02
    • 2019-06-30
    相关资源
    最近更新 更多