<分区>
我看了引用题urlencode vs rawurlencode?顺便说一下,我应该使用 rawurlencode
例如
If interoperability with other systems is important then it seems rawurlencode is the way to go.
但是为什么要发明urlencode
呢?是不是这个功能没用了?
<分区>
我看了引用题urlencode vs rawurlencode?顺便说一下,我应该使用 rawurlencode
例如
If interoperability with other systems is important then it seems rawurlencode is the way to go.
但是为什么要发明urlencode
呢?是不是这个功能没用了?
最佳答案
这取决于你追求的是什么。它们之间的主要区别在于它们编码的标准,当然还有空格。
urlencode
的编码方式与表单数据的编码方式相同
urlencode
将空格编码为 +
符号,而 rawurlencode
将它们编码为 %20
。
因此,在处理表单数据时,urlencode 会更可取(因为表单也将空格编码为 + 号)。否则,我认为 rawurlencode 是更明智的选择。
例如,您可能想要模拟通过 URL 提交的表单数据,您可以使用 urlencode。
关于php - urlencode 和 rawurlencode 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12555128/