您好我是 CakePHP 的新手,我使用 cakephp2.2 编写了一个基本的登录页面。
这是我的AppController
:
class AppController extends Controller {
var $components = array('Auth', 'Session');
var $helpers = array('Form');
public function appError($error) {
//Do whatever you want
debug($error);
}
}
我的用户控制器:app\controller\UsersController.php
class UsersController extends AppController {
var $name = 'Users';
var $components = array('Auth'); // Not necessary if declared in your app controller
/**
* The AuthComponent provides the needed functionality
* for login, so you can leave this function blank.
*/
function login() {
}
function logout() {
$this->redirect($this->Auth->logout());
}
}
而我的观点:app\user\login.ctp
<?php
echo $this->Session->flash('auth');
echo $this->Form->create('User');
echo $this->Form->input('username');
echo $this->Form->input('password');
echo $this->Form->end('Login');
?>
我得到:洞用户控制器代码和以下错误
\app\Controller\AppController.php(第 41 行)对象(MissingControllerException){
}