如何在 Kohana 3.2 中调用验证对象的 trim 函数?我正在使用:
$post = Validation::factory($this->request->post());
$post->rule('Email', 'trim');
最佳答案
从 3.2 开始,验证对象是只读的。在创建 Validation 对象之前过滤输入,如下所示:
$post = array_map('trim', $this->request->post()); // $post[key] = expression; if it is for one specific value
$post = Validation::factory($post);
// set validation rules etc
关于kohana - 如何在 Kohana 3.2 验证对象上调用 trim 函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7906320/