0

如何将 php 中的 foreach 函数转换为 asp 经典函数?

function startChatSession() {
$items = '';
if (!empty($_SESSION['openChatBoxes'])) {
    foreach ($_SESSION['openChatBoxes'] as $chatbox => $void) {
        $items .= chatBoxSession($chatbox);
    }
}
4

1 回答 1

1
<%
If Not isNull(Session("openChatBoxes")) Then

    ocbArray = SPLIT(Session("openChatBoxes"),",")

    IF isArray(ocbArray) THEN

       'Multiple values in Session object
       For ocb = 0 to UBOUND(ocbArray)

            'Loop through array and do something with each individual value
            response.write ocbArray(ocb) & "<br/>" 'writes out each open chat box

       Next

    ELSE
       'Only 1 value in Session object

    END IF

End If
%>
于 2013-10-31T09:19:29.627 回答