PHP 函数 urlencode() 和 rawurlencode() 的区别

来自:互联网
时间:2018-08-11
阅读:

详细的区别请看 PHP 官方文档 PHP urlencode() 和 PHP rawurlencode(),很长,仔细理解了一下,做下要点:

1. PHP 中对于 URL 进行编码,可以使用 urlencode() 或者 rawurlencode(),二者的区别是 urlencode() 把空格编码为 ‘+’,而 rawurlencode() 把空格编码为 ‘%20’。

2. rawurlencode() 遵守是94年国际标准备忘录 RFC 1738,urlencode() 实现的是传统做法,推荐在 PHP 中使用用 rawurlencode(),弃用 urlencode()。

返回顶部
顶部