array('phone', 'authorPhone'),
public function authorPhone($attribute){
$strlen = strlen($this->$attribute);
$this->addError($attribute, $strlen);
}
也可以传参
array('phone', 'authorPhone', 'type' => 1),
public function authorPhone($attribute, $params){
if($params['type'] == 1) {
$strlen = strlen($this->$attribute);
$this->addError($attribute, $strlen);
}
}
public function authorPhone($attribute){
$strlen = strlen($this->$attribute);
$this->addError($attribute, $strlen);
}
也可以传参
array('phone', 'authorPhone', 'type' => 1),
public function authorPhone($attribute, $params){
if($params['type'] == 1) {
$strlen = strlen($this->$attribute);
$this->addError($attribute, $strlen);
}
}