class CommentsController extends AppController {
function beforeFilter() {
parent::beforeFilter();
$this->Auth->allowedActions = array('add','edit');
}
但如果我http://mysite.com/comments/view/13我得到错误=>
Error: The action view is not defined in controller CommentsController
Error: Create CommentsController::view() in file: app/controllers/comments_controller.php.
<?php
class CommentsController extends AppController {
var $name = 'Comments';
function view() {
}
}
?>
Notice: If you want to customize this error message, create app/views/errors/missing_action.ctp
对于http://mysite.com/comments/edit/13 =&gt;
我收到了包含该评论的编辑页面。那不应该来。在编辑任何帖子之前,我会被提示登录。
为什么不工作?
答案 0 :(得分:1)
I got the edit page with that comment. That should not come. I should be prompted to login before editing any post.
删除第$this->Auth->allowedActions = array('add','edit');
行