我需要将编码的字符串传递给php页面。
将字符串转换为iso:
Dim result As Byte() = Encoding.Convert(Encoding.UTF8, Encoding.GetEncoding("iso-8859-1"), input)
我有这个代码来传递字符串,但我必须如何传递Byte(变量结果)而不是字符串(变量MyVarString)?
Dim client As WebClient
Dim data As Stream
Dim reader As StreamReader
Dim baseurl As String
baseurl = "http://example.com/api/mypage2.php"
client = New WebClient
client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)")
client.QueryString.Add("mensaje", MyVarString)
data = client.OpenRead(baseurl)
reader = New StreamReader(data)
s = reader.ReadToEnd()
data.Close()
reader.Close()
Etc.
答案 0 :(得分:0)
如果您的问题是如何传递字节数组,那么只需对Base64进行编码:
Dim encResult = Convert.ToBase64String(result)
然后在PHP中使用built-in decoder base64_decode(string)