本文整理汇总了PHP中CValidator::validate方法的典型用法代码示例。如果您正苦于以下问题:PHP CValidator::validate方法的具体用法?PHP CValidator::validate怎么用?PHP CValidator::validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CValidator
的用法示例。
在下文中一共展示了CValidator::validate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate
public function validate()
{
$validator = new CValidator();
$validator->validate($this);
}
示例2: checkValidator
/**
* Runs the given validator and throws an exception if it fails.
*
* @param $value
* @param CValidator $validator
*/
protected function checkValidator($value, CValidator $validator)
{
if (!$validator->validate($value)) {
self::exception(ZBX_API_ERROR_INTERNAL, $validator->getError());
}
}
示例3: validate
public function validate()
{
$data = $this->data;
$valid = true;
$this->error = array();
require_once CORE_PATH . 'CValidator.php';
$Validator = new CValidator($this->data);
foreach ((array) $this->fields as $key => $field) {
/* if (isset($field['required']) && ($field['required'] == true))
{
$Validator->addRule(new Required($field['name'], $field['title'] . ' обязательное поле'));
}*/
if (isset($field['validator_name']) && $field['validator_name'] != '') {
$Validator->addRule(new $field['validator']($field['name'], $field['validator_msg']));
}
}
$valid = $Validator->validate();
$this->error = $Validator->getError();
return $valid;
}