feat: 支持通过拼音搜索联系人
This commit is contained in:
@@ -2849,6 +2849,23 @@ class Base
|
||||
return $first ? strtoupper($first) : '#';
|
||||
}
|
||||
|
||||
/**
|
||||
* 中文转拼音
|
||||
* @param $str
|
||||
* @return string
|
||||
*/
|
||||
public static function cn2pinyin($str)
|
||||
{
|
||||
if (empty($str)) {
|
||||
return '';
|
||||
}
|
||||
if (!preg_match("/^[a-zA-Z0-9_.]+$/", $str)) {
|
||||
$pinyin = new Pinyin();
|
||||
$str = $pinyin->permalink($str, '');
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存数据
|
||||
* @param $name
|
||||
|
||||
Reference in New Issue
Block a user