Zend_Validate::is() Static Check, get validation message work around(Zend_Validate::is() 静态检查,获取验证消息解决方法)
问题描述
有谁知道在静态范围内使用 Zend_Validate 获取验证消息的方法吗?
Does anyone know of a way to get validation messages from using Zend_Validate in static scope?
Zend_Validate::is($value, $validator[0], $validator[2])
文档明确表示不能选择获取消息:http://framework.zend.com/manual/en/zend.validate.introduction.html#zend.validate.introduction.static
The docs say explicitly that getting the messages isn't an option: http://framework.zend.com/manual/en/zend.validate.introduction.html#zend.validate.introduction.static
有点令人沮丧,但我想知道是否有人知道 Zend 中用于从验证字符串获取消息的任何其他方法?
Slightly discouraging, but I was wondering if someone knew of any other methods that are inside Zend for getting messages from a validation string?
如果有人感兴趣,我正在关注一篇关于在模型级别进行验证的精彩文章:http://www.cambraca.com/2011/03/validation-in-zend-framework-model.html
I'm following a great article about validating at the model level if anyone is interested: http://www.cambraca.com/2011/03/validation-in-zend-framework-model.html
感谢您的帮助,-赛斯
推荐答案
恐怕做不到.看,消息附加到每个 Validator object - 您不能将它们附加到 class(除非您使用静态消息属性和静态 setter/getter 并将使用它).
I'm afraid it just cannot be done. See, the messages are attached to each Validator object - you cannot attach them to class (unless you make your own implementation of the validation logic with static message properties and static setter/getter for it and will use it instead).
这篇关于Zend_Validate::is() 静态检查,获取验证消息解决方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Zend_Validate::is() 静态检查,获取验证消息解决方法


基础教程推荐
- 在 CakePHP 2.0 中使用 Html Helper 时未定义的变量 2021-01-01
- 使用 PDO 转义列名 2021-01-01
- 如何在 Symfony 和 Doctrine 中实现多对多和一对多? 2022-01-01
- 找不到类“AppHttpControllersDB",我也无法使用新模型 2022-01-01
- Doctrine 2 - 在多对多关系中记录更改 2022-01-01
- 在 yii2 中迁移时出现异常“找不到驱动程序" 2022-01-01
- PHP 守护进程/worker 环境 2022-01-01
- phpmyadmin 错误“#1062 - 密钥 1 的重复条目‘1’" 2022-01-01
- 如何在 XAMPP 上启用 mysqli? 2021-01-01
- HTTP 与 FTP 上传 2021-01-01