我已阅读 some stuff关于表单数据编码,但有一件事仍不清楚。在 enctype="application/x-www-form-urlencoded"的情况下,我们需要手动对数据进行 urlencode,don't we ?
... Forms submitted with this content type must be encoded as follows
必须由谁编码?通过浏览器?还是应用程序开发人员?
另一件事是——在 multipart/form-data 的情况下,使用或应该使用什么编码(如果有)?
我有点误导了这么大的提前。
最佳答案
实际上,浏览器会自动对数据进行 url 编码。还有这个w3 docs首先是为那些做浏览器的人准备的。因此,Forms submitted with this content type must be encoded as follows
这句话意味着数据应该由浏览器编码。无论如何,可以通过查看表单数据处理脚本中的原始帖子来检查它(如果 php 看起来像 file_get_contents("php://input");
)
关于forms - 表单数据是否由浏览器自动编码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13920126/