Home  >  Article  >  Backend Development  >  Example of using the validator InArray of the zf framework_PHP tutorial

Example of using the validator InArray of the zf framework_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:35:58813browse

Copy code The code is as follows:

require_once("Zend/Loader.php");
Zend_Loader::loadClass("Zend_Validate");
Zend_Loader::loadClass("Zend_Validate_InArray");

function check_inarray($person)
{
$array = array('Zhang San','Li Si','Wang Wu','Zhao Liu','Tian Qi');
$Validate = new Zend_Validate_InArray($array);
if ($Validate -> isValid($person))
{
echo "There is this person!";
}
else
{
echo "There is no such person!";
}
}
$person = 'Zhang San';
check_inarray($person);
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/741262.htmlTechArticleCopy the code as follows: ?php require_once("Zend/Loader.php"); Zend_Loader::loadClass(" Zend_Validate"); Zend_Loader::loadClass("Zend_Validate_InArray"); function check_inarray($p...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn