Kohana 图片上传验证
我在图像验证方面遇到问题,文档一如既往没有帮助,因此我进行了简单的验证来检查图像是否已上传
$validate = Validation::factory($_FILES)
->rule('file', array('Upload::not_empty'));
但这给了我错误 ErrorException [警告]:call_user_func_array() 期望参数 1 是有效的回调,数组必须恰好有两个成员
什么可能导致此错误?
I'm having problems with image validation, documentation as always doesn't help, so there is my simple validation to check if image was uploaded
$validate = Validation::factory($_FILES)
->rule('file', array('Upload::not_empty'));
But this gives me errorErrorException [ Warning ]: call_user_func_array() expects parameter 1 to be a valid callback, array must have exactly two members
What could be causing this error?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
rule
的第二个参数是 PHP 回调。所以这就足够了,因为上传类中的 not_empty 方法是静态的:当该方法不是静态时,您只需要执行数组语法:
The 2nd argument for
rule
is a PHP callback. So this would suffice because the not_empty method in the upload class is static:You only really need to do the array syntax when the method is not static: