php - urlencode 和 rawurlencode 有什么区别?

标签 php security

<分区>

我看了引用题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/

相关文章:

php - 通过单击在 xampp 中运行 php 项目

php - zend 搜索 lucene 查询 api : boosting a term

php - Yii - 在数据库中插入空值, 'safe' 属性集

PHP PDO 在每次写操作时都失败

android - 在联想平板电脑上以编程方式/正常保护设置选项卡的可能方法? (包括密码保护它的安卓程序)

php - 如何用php计算在线考试系统的总分

java - 使用公钥/私钥签名进行身份验证 : What's a good message (digest)?

node.js - NodeJS OAuth2.0原理

REST API 访问控制从访问 token 与路径参数中提取主题

vb.net - 在没有签名证书的情况下部署 VSTO 加载项?