This article mainly introduces the use of the ZF Framework verifier using the example (custom validator and validator chain), the need for friends can refer to the following
The code is as follows: _messages[] = "The value you entered is not a common multiple of 3 and 5!" "; Terminates the program return false; }//return true return true; }//Define error method for interface public function getmessages () {return $this-_messages;}//Define extract error message (not available) public function geterrors () { }}//out-of-class definition detection common multiple method function Check_num ($num) {//Instantiate validator class $Validate = new Zend_validate ();//Add Validator feature class, add custom Validator function class, form validator chain $ Validate-Addvalidator (New Zend_validate_int ()), Addvalidator (New Gongbeinum ()); Check parameters if (! $Validate, IsValid ($num)) {//If error loop error message and output foreach ($Validate, Getmessages () as $value) {echo $val Web. "
"; return false; }}}//Specify the value of $NUM1 = ' 15 ';//Run Calibration Method Check_num ($num 1);? >
http://www.bkjia.com/PHPjc/741457.html www.bkjia.com true http://www.bkjia.com/PHPjc/741457.html techarticle This article mainly introduces the use of the ZF Framework checker using the example (custom validator and validator chain), the need for friends can refer to the following code:? Phprequire_once (zend/loader.php);