Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对 Kohana 的验证对象有疑问。例如,我想检查该user_id字段。它必须是一个大于 0 的数字。我尝试过以下操作:
user_id
$validation->rule("user_id", function($str){ return (is_numeric($str) && $str > 0); }
我也输入了这个字段,只是一个字符串“sdfgwertxcvb”。但是 $validation->check() 返回“TRUE”。为什么?
请向我解释我做错了什么?
https://github.com/kohana/core/blob/3.3/master/classes/Kohana/Validation.php#L192
有一个例子如何使用它