$temp_len = (strlen ( $name ) + mb_strlen ( $name, 'utf-8' )) / 2;
if ($temp_len < 1 || $temp_len > 14) {
$fail = array ('desc1' => '名称长度必须为1-14个字符','code' => 3);
return array ('fail' => $fail);
} else {
$reg = '/^[\x{4e00}-\x{9fa5}a-zA-Z0-9]+$/u'; //匹配中文字符,数字,字母的正则表达式
if (preg_match ( $reg, $name )) {
} else {
$fail = array ('desc1' => '名称只能使用汉字,数字或字母。','code' => 3);
return array ('fail' => $fail);
}
}
if ($temp_len < 1 || $temp_len > 14) {
$fail = array ('desc1' => '名称长度必须为1-14个字符','code' => 3);
return array ('fail' => $fail);
} else {
$reg = '/^[\x{4e00}-\x{9fa5}a-zA-Z0-9]+$/u'; //匹配中文字符,数字,字母的正则表达式
if (preg_match ( $reg, $name )) {
} else {
$fail = array ('desc1' => '名称只能使用汉字,数字或字母。','code' => 3);
return array ('fail' => $fail);
}
}