こんにちは、私は 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);
}
}
My UsersController: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');
?>
私は得ています: 穴の UserController コードと以下のエラー
\app\Controller\AppController.php (41行目) object(MissingControllerException) {
}