Examples of using the zf framework validator. This article describes how to use the zf framework validator (custom validator and validator chain). If you need it, refer to the following code :? Phprequire_once (ZendLoader. php); this article mainly introduces the use example of the zf framework validator (custom validator and validator chain). For more information, see
The code is as follows: _ Messages [] = "the value you entered is not a public multiple of 3 and 5! "; // Terminate the program return false;} // return true;} // define the interface's error method public function getMessages () {return $ this-> _ messages ;} // define extraction error message (optional) public function getErrors () {}}// out-of-class definition detection public multiple method function check_num ($ num) {// instantiate the validator class $ Validate = new Zend_Validate (); // add the validator function class and add the UDF class, form the validator chain $ Validate-> addValidator (new Zend_Validate_Int ()-> addValidator (new GongBeiNum (); // verify the parameter if (! $ Validate-> isValid ($ num) {// if an error loop error message is returned and foreach ($ Validate-> getMessages () as $ value) {echo $ value ."
"; Return false ;}}// specify the value to be judged $ num1 = '15'; // run the check_num ($ num1) verification method;?>
Refer (custom validator and validator chain). If you need a friend, refer to the following code :? Phprequire_once (Zend/Loader. php );/...