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() 静态检查,获取验证消息解决方法
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- PHP - if 语句中的倒序 2021-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
