如何使用yii框架在模型中制定规则?
在我的应用程序中,我有一个字段名contact_no,因为我需要像+91-999-846-1062这样的验证 如果我这样写的话 数组'contact_no','pattern'=>'/^[0-9-\s+]+$/' 然后我犯了一个错误如何使用yii框架在模型中制定规则?,yii,Yii,在我的应用程序中,我有一个字段名contact_no,因为我需要像+91-999-846-1062这样的验证 如果我这样写的话 数组'contact_no','pattern'=>'/^[0-9-\s+]+$/' 然后我犯了一个错误 invalid validation rule. The rule must specify attributes to be validated and the validator name. 然后在模型中编写什么。您需要的是一个“模式”。此验证程序的名称为“匹
invalid validation rule. The rule must specify attributes to be validated and the validator name.
然后在模型中编写什么。您需要的是一个“模式”。此验证程序的名称为“匹配”。语法不正确,请尝试以下操作:
array('contact_no', 'match', 'pattern'=>'/^[0-9-()\s+]+$/'),