0
我試圖檢查一個變量的值是否在數組中。有一些困難。我的數組存儲在global.asa中。檢查經典的asp數組中的變量
Dim aTree(5)
aTree(0) = "a"
aTree(1) = "b"
aTree(2) = "c"
aTree(3) = "d"
aTree(4) = "e"
aTree(5) = "f"
Application("aTree") = aTree
變量我試圖檢查商店的一些HTML內容
<% If tree = "a" Then %>
<div class="card bg_white">
<h1 class="bold small-caps tbrown">my content</h1>
</div>
<% End If %>
我試圖做檢查這樣
<% tree = Request("tree")
if in_array(tree, aTree) then %>
You've found it
<% End if %>
我有了這個笨重的版本該作品
(tree <> "" and tree <> "a" and tree <> "b" and tree <> "c" and tree <> "d" and tree <> "e" and tree <> "f")
Bu我想用一個更優雅的方式來處理數組。
幫助不大。謝謝。