Home > Backend Development > PHP Tutorial > 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
Release: 2016-07-13 10:35:58
Original
836 people have browsed it

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...
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template