这是一个示例三重数组循环器(使用静态变量,因此您可以看到它的变化)
这是我定制的,注意存储增量变量的语法(如计数器等)
该循环器将循环浏览您的所有选项(在下面的示例中,有 6*5*4=120 个选项)。它会回显每个选项一次,然后移动到下一个选项。
example_array_looper
storeEval new Date().getTime(); timeStart
echo ${timeStart}
storeEval new Array("1","2","3","4"); toparray
storeEval new Array("A", "B", "C", "D", "E"); middlearray
storeEval new Array("i","ii","iii","iv","v","vi"); bottomarray
getEval topindex=0;
getEval middleindex=0;
getEval bottomindex=0;
getEval loopCounter=0;
while topindex < storedVars['toparray'].length
storeEval topindex temptop
while middleindex < storedVars['middlearray'].length
storeEval middleindex tempmiddle
while bottomindex < storedVars['bottomarray'].length
storeEval bottomindex tempbottom
echo javascript{storedVars['toparray'][storedVars['temptop']]+" -> "+storedVars['middlearray'][storedVars['tempmiddle']]+" -> "+storedVars['bottomarray'][storedVars['tempbottom']]}
getEval bottomindex++;
getEval loopCounter++;
endWhile
getEval bottomindex=0;
getEval middleindex++;
endWhile
getEval bottomindex=0;
getEval middleindex=0;
getEval topindex++;
endWhile
storeEval loopCounter loops
echo Total number of loops is: ${loops}
storeEval new Date().getTime(); timeEnd
echo ${timeEnd}
storeEval (${timeEnd}-${timeStart})/1000 scriptRunTime
echo Total Run Time for Script was: ${scriptRunTime}s
storeEval ${scriptRunTime}/${loops} averageTime
echo Average Loop Duration was: ${averageTime}s
我选择删除所有 html 标记(因此差距应该很明显)。StoreEval 命令最适合保存循环计数器,因为您可以将它们用作一步而不是 2 的增量。