cakephp表单验证 [英] cakephp form validation
本文介绍了cakephp表单验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有人知道如果在cakePHP中有一个表单的VALIDATE函数,并查看errors数组?
i.ve检查文档,但是我发现的唯一的东西是SAVE函数,我只需要知道我发送的数据是否有效,并手动检查错误。
does anyone know if there is a VALIDATE function for a form in cakePHP and view the errors array? i.ve checked the documentation but the only thing i found is the SAVE function, i just need to know if the data i send is valid and review the errors manually.
推荐答案
尝试此
$this->ModelName->set( $this->data );
if ($this->ModelName->validates()) {
// it validated logic
} else {
// didn't validate logic
}
并阅读 this
这篇关于cakephp表单验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文