大家好,
许久不写博客,略显生疏了。
最近一段时间发生了很多很多的事情,心情很沮丧,可能是本命年的缘故。
。。。。。
吐槽命运到此为止,接下来给你们分享一下我收藏的代码。
'Bytes转为String
Function BytesToStr(InString)
Dim BytesStream, StringReturn
Set BytesStream = Server.CreateObject("Adodb.Stream")
BytesStream.Type = 2
BytesStream.Open
BytesStream.WriteText InString
BytesStream.Position = 0
BytesStream.CharSet = "UTF-8"
BytesStream.Position = 2
StringReturn = BytesStream.ReadText
BytesStream.Close
Set BytesStream = nothing
BytesToStr = StringReturn
End Function
'获取Post中的字节流大小
PostSize = Request.TotalBytes
If PostSize = 0 Then
Response.Write("Null")
Response.End()
End If
'读取字节流
InJsonBytes = Request.BinaryRead(PostSize)
'将字节流转为字符串
InJsonString = BytesToStr(InJsonBytes)
分享完毕