【发布时间】:2013-12-03 19:04:29
【问题描述】:
http://book.cakephp.org/2.0/en/tutorials-and-examples/blog-auth-example/auth.html
我正在关注 cakephp 网站上的本教程。我被困在了这个
public function isAuthorized($user) {
// All registered users can add posts
if ($this->action === 'add') {
return true;
}
if (in_array($this->action, array('edit', 'delete'))) {
$postId = $this->request->params['pass'][0]; //what is this?
if ($this->Post->isOwnedBy($postId, $user['id'])) {
return true;
}
}
return parent::isAuthorized($user);
}
这是什么意思?我知道 $this 指的是控制器,但 param['pass'] 是什么?他们在哪里以及如何得到这个?
$postId = $this->request->params['pass'][0];
【问题讨论】: