gpt4 book ai didi

yii - 在表单 Yii2 中添加仅字母验证

转载 作者:行者123 更新时间:2023-12-04 20:23:01 25 4
gpt4 key购买 nike

我想通过特殊字符验证我的姓名文本框

我试试这个:-

public function rules() 
{
[
'full_name', 'match',
'pattern' => '/^[a-zA-Z\s]+$/',
'full_name' => 'full_name can only contain word characters'
]
}

最佳答案

尝试这个:

public function rules() 
{
return [
'full_name', 'match',
'pattern' => '/^[a-zA-Z\s]+$/',
'message' => 'full_name can only contain word characters'
];
}

引用 Yii2 Core Match Validator

关于yii - 在表单 Yii2 中添加仅字母验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53910321/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com