Answer the question
In order to leave comments, you need to log in
Why doesn't the controller save Cyrillic?
Hello again,
so I registered the rules and regular
return [
['username', 'filter', 'filter' => 'trim'],
['username', 'required'],
['username', 'match', 'pattern' => '#^[\w_-А-Яа-я\.]+$#i'],
['username', 'string', 'min' => 2, 'max' => 255],
public function signup()
{
if ($this->validate()) {
$user = new User();
$user->username = $this->username;
$user->lastname = $this->lastname;
//...
if ($user->save()) {
// .....
}
return $user;
}
return null;
}
Answer the question
In order to leave comments, you need to log in
Well, at least you have an error in the regular expression. First, the hyphen needs to be escaped if it's not a range. Secondly, \w already contains the Russian alphabet and an underscore, like )
u(PCRE_UTF8)
php.net/manual/en/regexp.reference.unicode.php
php.net/manual/en/reference.pcre.pattern.modifiers.php
I checked,
the connection to the database,
the table in the database, each field, I
also checked the files - utf8
Here, but still - saving does not work, more precisely, it does not give an error "type saves" I look in the database and there is no record. As soon as I change to EN, everything saves. Is it because Fri 13th chtoli?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question