在经典的 ASP 函数中,当我在另一个函数中执行循环时,如下面的代码所示,出现堆栈溢出错误。
Function shift(x,y)
shift = x
For i = 1 to y
shift = shift*2
Next
End Function
Function translate_url(iVal)
sAlpha = "abcdefghijklmnopqrstuvwxyz-_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
doWrite = False
iBase = 63 'DO NOT CHANGE
For i = 4 to 0 step -1
iPos = (iVal and shift(iBase, i*6))/shift(1, i*6)
If iPos Then doWrite = True
If doWrite Then translate_url = translate_url & Mid(sAlpha, iPos + 1,1)
Next
End Function
arr = Split("1,2,3,4,5,6,7,8,9,0",",")
For Each i In arr
response.Write(translate_url(arr(i)))
next
当我删除函数外的循环时,不会发生错误。例如:
response.Write(translate_url(arr(1)))
返回“c”。
我需要做什么才能让代码顺着数组顺流而下,并根据函数返回对应的值?