gpt4 book ai didi

HTTP POST 请求 - 发送键值对 - 值包含 '&'

转载 作者:可可西里 更新时间:2023-11-01 17:08:55 24 4
gpt4 key购买 nike

'&' 用作键和值对之间的分隔符。

但我的值之一包含“&”,我该如何发送此数据?

最佳答案

您必须对其进行 url 编码(大多数与 http 相关的库都具有这样做的实用函数)。

例如key=&value会变成key=%26value

你可以找到more information在维基百科中。

When a character from the reserved set (a "reserved character") has special meaning (a "reserved purpose") in a certain context, and a URI scheme says that it is necessary to use that character for some other purpose, then the character must be percent-encoded. Percent-encoding a reserved character involves converting the character to its corresponding byte value in ASCII and then representing that value as a pair of hexadecimal digits. The digits, preceded by a percent sign ("%") which is used as an escape character, are then used in the URI in place of the reserved character. (For a non-ASCII character, it is typically converted to its byte sequence in UTF-8, and then each byte value is represented as above.) The reserved character "/", for example, if used in the "path" component of a URI, has the special meaning of being a delimiter between path segments. If, according to a given URI scheme, "/" needs to be in a path segment, then the three characters "%2F" or "%2f" must be used in the segment instead of a raw "/".

这个问题可能与this 重复.

关于HTTP POST 请求 - 发送键值对 - 值包含 '&',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28242540/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com