xmlhttp对象post同步情况下send卡住
Dim XmlHttp2 As Object
Set XmlHttp2 = CreateObject("Msxml2.XMLHTTP")
XmlHttp2.open "POST", hosturl & "test.php", False
XmlHttp2.setRequestHeader "Content-Length:", Len(str)
XmlHttp2.setRequestHeader "Content-Type", "application/x-www-form-encoded"
XmlHttp2.send (str)
For I = 0 To 100 * POST_TIMEOUT
If XmlHttp2.readyState = 4 Then Exit For
Sleep 10
DoEvents
Next
If XmlHttp2.readyState <> 4 Then Exit Function
sendcheck = XmlHttp2.responseText
Set XmlHttp2 = Nothing
POST一个文件,当在网络比较迟缓的情况下一直卡在XmlHttp2.send (str)里,如何让它10秒后自动结束此行啊?
[解决办法]
im XmlHttp2 As Object
Set XmlHttp2 = CreateObject("Msxml2.XMLHTTP")
XmlHttp2.open "POST", hosturl & "test.php", False
XmlHttp2.setRequestHeader "Content-Length:", Len(str)
XmlHttp2.setRequestHeader "Content-Type", "application/x-www-form-encoded"
XmlHttp2.send (str)
XmlHttp2.WaitForResponse 加一个这个 导步等待