PHP: 一段自动补位的函数: Function FormatSn(getNum,getBit) Dim FormatsnNum,Formatsnpre,Formatsnj FormatsnNum = getBit - len(getNum) For Formatsnj = 1 To FormatsnNum Formatsnpre = Formatsnpre & "0" Next FormatSn = Formatsnpre & getNum End Function 使用方法 FormatSn(getNum,getBit) getNum 计数 getBit 共几位