fixed
This commit is contained in:
@@ -2386,4 +2386,21 @@ FROM information_schema.columns WHERE TABLE_NAME='{$tablename}' AND table_schema
|
||||
$ver = substr($str,0,3);
|
||||
return $ver;
|
||||
}
|
||||
|
||||
/**
|
||||
* desc:根据字符串生成颜色码
|
||||
* author:wh
|
||||
* @param $string
|
||||
* @return string
|
||||
*/
|
||||
static function stringToColor($string) {
|
||||
// 使用crc32函数计算字符串的哈希值
|
||||
$hash = crc32($string);
|
||||
|
||||
// 将整数哈希值转换为16进制,并填充0以确保6位长度
|
||||
$color = sprintf("%06X", $hash & 0xFFFFFF);
|
||||
|
||||
// 返回颜色码
|
||||
return '#' . $color;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user