2013-10-31 69 views
0

如何將PHP中的foreach函數轉換爲asp classic函數?將PHP函數轉換爲ASP

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

回答

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 
%> 
+0

非常感謝你和我試試這個代碼 – user2659025