Commit a099775c authored by jiangkebao's avatar jiangkebao
Browse files

数字转字母函数

parent c19a1298
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -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);
    }
}