本文整理汇总了PHP中Valid::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP Valid::validate方法的具体用法?PHP Valid::validate怎么用?PHP Valid::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Valid
的用法示例。
在下文中一共展示了Valid::validate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
/**
* Check rules on given file.
*
* @param Array $_FILES superarray.
* @param String Index of file to check in $_FILES array.
* @return Boolean
*/
function validate($files, $index)
{
if (is_array($files) && isset($files[$index])) {
$this->addRule(new Rule_File());
return parent::validate($files[$index]);
} elseif ($this->isRequired) {
return false;
} else {
return true;
}
}
示例2: testRequiredAndPermissive
/**
* Need to throw an error if the value is required but the rule return true
* even with empty values
*/
function testRequiredAndPermissive()
{
$r =& new MockRule($this);
$r->setReturnValue('isValid', true);
$v = new Valid();
$v->disableFeedback();
$v->required();
$v->addRule($r);
$this->assertFalse($v->validate(''));
}
示例3: DataBase
<?php
$objDB = new DataBase();
$objLang = new Lang();
$objAccess = new Access($objDB);
$objValid = new Valid($objDB, $objLang->text);
if (filter_input(INPUT_POST, 'action') === 'reg') {
if ($objValid->validate()) {
$objDB->addUser($objValid->request);
}
} else {
$objValid->clear();
}
$accessType = $objAccess->accessType;
$page = $objAccess->page;
$text = $objLang->text;
$errors = $objValid->errorText();
$fields = $objValid->request;
include_once 'header_view.php';
include_once 'registration_view.php';
include_once 'footer_view.php';