当前位置: 首页>>代码示例>>PHP>>正文


PHP CValidator::addError方法代码示例

本文整理汇总了PHP中CValidator::addError方法的典型用法代码示例。如果您正苦于以下问题:PHP CValidator::addError方法的具体用法?PHP CValidator::addError怎么用?PHP CValidator::addError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CValidator的用法示例。


在下文中一共展示了CValidator::addError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addErrorInternal

 /**
  * Adds an error about the specified attribute to the active record.
  * This is a helper method that call addError which performs message selection and internationalization.
  * 
  * Construct the message and the params array to call addError().
  * 
  * @param CModel $object the data object being validated
  * @param string $attribute the attribute being validated
  * @param string $tested_param the tested property (eg 'upper case') for generating the error message
  * @param array $values values for the placeholders :is and :should in the error message - array(['found'] => <int>, ['required'] => <int>)
  */
 private function addErrorInternal($object, $attribute, $tested_param, array $values)
 {
     $message = "Mật khẩu không chứa đủ kí tự :tested_param. Mật khẩu ít nhất phải chứa :required kí tự :tested_param.";
     $params = array(':attribute' => $attribute, ':tested_param' => $tested_param, ':found' => $values['found'], ':required' => $values['required']);
     parent::addError($object, $attribute, $message, $params);
 }
开发者ID:nguyendvphp,项目名称:onlinetraining,代码行数:17,代码来源:SPasswordValidator.php

示例2: addErrorInternal

 /**
  * Adds an error about the specified attribute to the active record.
  * This is a helper method that call addError which performs message selection and internationalization.
  *
  * Construct the message and the params array to call addError().
  *
  * @param CModel $object the data object being validated
  * @param string $attribute the attribute being validated
  * @param string $tested_param the tested property (eg 'upper case') for generating the error message
  * @param array $values values for the placeholders :is and :should in the error message - array(['found'] => <int>, ['required'] => <int>)
  */
 private function addErrorInternal($object, $attribute, $tested_param, array $values)
 {
     $message = Yii::t(__CLASS__ . '.' . __CLASS__, '{attribute} doesn\'t contain enough {tested_param}. {found} found whereas it must be at least {required}.');
     $params = array('{tested_param}' => $tested_param, '{found}' => $values['found'], '{required}' => $values['required']);
     parent::addError($object, $attribute, $message, $params);
 }
开发者ID:amlap,项目名称:Yii-Extensions,代码行数:17,代码来源:XPasswordValidator.php


注:本文中的CValidator::addError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。