1-1条,共1条数据.
姓名评论创建日期操作
demo public function rules()
{
return [
[['name', 'className'], 'required'],
[['className'], 'string'],
[['className'], 'classExists']
];
}

/**
* Validate class exists
*/
public function classExists()
{
if (!class_exists($this->className)) {
$message = Yii::t('rbac-admin', "Unknown class '{class}'", ['class' => $this->className]);
$this->addError('className', $message);
return;
}
if (!is_subclass_of($this->className, Rule::className())) {
$message = Yii::t('rbac-admin', "'{class}' must extend from 'yii\rbac\Rule' or its child class", [
'class' => $this->className]);
$this->addError('className', $message);
}
}
2016-09-19删除