有没有办法在CakePHP的Auth中包含要检查的字段?
例如:if status_id == 1
答案 0 :(得分:1)
您需要在auth组件设置上添加status_id = 1 ..比如
public $components = array(
'Session',
'Auth' => array(
'loginRedirect' => array('controller' => 'posts', 'action' => 'index'),
'logoutRedirect' => array('controller' => 'pages', 'action' => 'display', 'home'),
'authorize' => array('Controller'),
'authenticate' => array(
'Form' => array(
'scope' => array(
'status_id' => 1
)
)
)
)
);