私はcakephpチュートリアルを読み始めています。チュートリアルに示されているとおりに、ソースコードをコピーします。
ブログのチュートリアルを完了しましたが、すべて問題ないようです。今は「シンプルな認証と承認のアプリケーション」(http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/ auth.html)チュートリアルですが、この問題が発生しています。
追加ページは正常に読み込まれます。
"... / app / webroot / index.php / Users / add"
送信を押すと、このURL(追加の「Users」文字列を含む)にリダイレクトされ、エラーメッセージが表示されます。
"... / app / webroot / index.php / Users / Users / add"
Missing Method in UsersController Error: The action Users is not defined in controller UsersController Error: Create UsersController::Users() in file: app/Controller/UsersController.php. class UsersController extends AppController { public function Users() { } }
どこからチェックを始めたらいいか教えてください、ありがとう。
AppController
class AppController extends Controller {
public $components = array(
'Session',
'Auth' => array(
'loginRedirect' => array('controller' => 'posts', 'action' => 'index'),
'logoutRedirect' => array('controller' => 'pages', 'action' => 'display', 'home'),
'authorize' => array('Controller') // Added this line
)
);
public function beforeFilter() {
$this->Auth->allow('index', 'view');
}
public function isAuthorized($user) {
// Admin can access every action
if (isset($user['role']) && $user['role'] === 'admin') {
return true;
}
// Default deny
return false;
}
}