php的urlencode和rawurlencode对空格编码的区别
阿神
阿神 2017-04-10 13:12:17
0
1
816

我最近在使用urlencode对字符串进行编码时发现它将空格字符串编码为了+,但是如果你用rawurlencode来编码,空格字符串就会变为%20。而且在浏览器里输入空格后,它都会将其转化为%20

这两者有什么区别吗?后端服务器在接受这两种编码请求时会有和不同呢?

我试着将http://zh.wikipedia.org/wiki/Internet%20Explorer%207网址替换为http://zh.wikipedia.org/wiki/Internet+Explorer+7,发现就无法识别了。

阿神
阿神

闭关修行中......

모든 응답(1)
阿神

From Wikipedia (emphasis and link added):

When data that has been entered into HTML forms is submitted, the form field names and values are encoded and sent to the server in an HTTP request message using method GET or POST, or, historically, via email. The encoding used by default is based on a very early version of the general URI percent-encoding rules, with a number of modifications such as newline normalization and replacing spaces with "+" instead of "%20". The MIME type of data encoded this way is application/x-www-form-urlencoded, and it is currently defined (still in a very outdated manner) in the HTML and XForms specifications.

来源:
http://stackoverflow.com/questions/16...

其他参考:
http://stackoverflow.com/questions/12...

최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!