我正在尝试学习 Kohana 的 Auth 模块,但登录方法总是返回 false。
控制器:
<?php defined('SYSPATH') OR die('No Direct Script Access');
class Controller_Auth extends Controller {
public function action_index() {
if($_POST) {
$this->login();
}
$this->template = View::factory('login');
echo $this->template;
}
private function login() {
$user = ORM::factory('user');
$data = array('username' => 'wilson', 'password' => '123');
if(!$user->login($data)) {
echo 'FAILED!';
}
}
private function logout() {
}
}
?>
模型:
<?php defined('SYSPATH') or die('No direct script access.');
class Model_User extends Model_Auth_User {
}
?>