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() 静态检查,获取验证消息解决方法
基础教程推荐
- PHP 类:全局变量作为类中的属性 2021-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 如何替换eregi() 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
