recommendation for a php validation framework

萝らか妹 提交于 2019-12-07 11:14:39

问题


I'm validating allot of fields now in PHP, and I have to preform basic (string length ect.) and more complex (strip <> tags, for example)

Can anyone recommend a class that does this, or maybe a framework, or maybe some functions that do these things?


回答1:


I assume you're validating POSTed forms: use Zend_Form and Zend_Filter




回答2:


If you're using PHP >= 5.2.0 then you can use PHP's built in filter functions. In particular, have a look at filter_var_array, which you can use to validate an array of inputs, each with its own validation rules. If you don't want to buy in to a complete framework then these might prove useful.

Alternatively, I've found Kohana's validation library to be very good.




回答3:


Just see php validation class ,it has over 60 validation methods with in single php class.




回答4:


Respect/Validation

The most awesome validation engine ever created for PHP.

use Respect\Validation\Validator as v;

$number = 123;
v::numeric()->validate($number); // true



回答5:


This is ace: http://code.google.com/p/phpv/

Small, cool, easily extensible and what's more: I developed it! :)

It's context agnostic too and one can use it for validation in CLI scripts as well.

Also it uses namespaces which have FINALLY been added to the language. So no more name collisions and all that sh*t.

Cheers



来源:https://stackoverflow.com/questions/981094/recommendation-for-a-php-validation-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!