Commit a099775c authored by jiangkebao's avatar jiangkebao

数字转字母函数

parent c19a1298
...@@ -660,4 +660,23 @@ if (!function_exists('make_has_relation_function')) { ...@@ -660,4 +660,23 @@ if (!function_exists('make_has_relation_function')) {
} }
if (!function_exists('int_to_chr')) {
/**
* 数字转字母 (类似于Excel列标)
* @param $index 索引值
* @param int $start 字母起始值
* @return string 返回字母
*/
function int_to_chr($index, $start = 65)
{
$str = '';
if (floor($index / 26) > 0) {
$str .= int_to_chr(floor($index / 26) - 1);
}
return $str . chr($index % 26 + $start);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment