给定以下控制器:
class UsersController extends AppController {
public function findUser() {
...
$this->User->findUser($this->request->query['u']);
...
}
}
以及以下型号:
class User extends AppModel {
public $validate = array(
'username' => array(
'rule' => array('minLength', '8'),
'message' => 'Username must be at least 8 characters'
)
);
public function findUser($username) {
return $this->find('all', array(
'conditions' => array('username' => $username),
));
}
}
例如,如果我在 url 中输入这个:http://example.com/users/findUser?u=a
验证器不会被触发。为什么?