在做Excel上传解析时,为了动态配置Excel与数据库表对应关系,由数组索引关联到Excel的某一列,需要将索引值转换为Excel列标,所以就写了这个方法,现在把代码帖出来,如果有更好的方法还请分享下,谢谢! /**<br>
* 数字转字母 (类似于Excel列标)<br>
* @param Int $index 索引值<br>
* @param Int $start 字母起始值<br>
* @return String 返回字母<br>
* @author Anyon Zou <anyon><br>
* @date 2013-08-15 20:18<br>
*/<br>
function IntToChr($index, $start = 65) {<br>
$str = '';<br>
if (floor($index / 26) > 0) {<br>
$str .= IntToChr(floor($index / 26)-1);<br>
}<br>
return $str . chr($index % 26 + $start);<br>
}<br>
<br>
/**<br>
* 测试<br>
*/<br>
function test() {<br>
echo IntToChr(0); //# A<br>
echo IntToChr(1); //# B<br>
// ...<br>
echo IntToChr(27); //# AB<br>
}</anyon>
AD:真正免费,域名+虚机+企业邮箱=0元

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Chinese version
Chinese version, very easy to use

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

WebStorm Mac version
Useful JavaScript development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment