URL編碼和解碼

escapeunescape
編碼: 解碼:
encodeURIdecodeURI
編碼: 解碼:
encodeURIComponentdecodeURIComponent
編碼: 解碼:

JS escape,unescape

原理:对除ASCII字母 数字 标点符号 @*_+-./ 以外的其他字符进行编码

編碼:escape('http://www.h3399.cn/')

解碼:unescape('http%3A//www.h3399.cn/')

JS encodeURI,decodeURI

原理:返回編碼爲有效的統一資源標識符(URI)的字符串,不會被編碼的字符:!@#$&*()=:/;?+'

編碼:encodeURI('http://www.h3399.cn/')

解碼:decodeURI('http://www.h3399.cn/')

JS encodeURIComponent,decodeURIComponent

原理:對URL的組成部分進行個別編碼,而不用于對整個URL進行編碼

編碼:encodeURIComponent('http://www.h3399.cn/')

解碼:decodeURIComponent('http%3A%2F%2Fwww.h3399.cn%2F')

PHP urlencode,urldecode

原理:urlencode 将空格编码为加号"+"

編碼:urlencode('http://www.h3399.cn/')

解碼:urldecode('http%3A%2F%2Fwww.h3399.cn%2F')

PHP rawurlencode,rawurldecode

原理:rawurlencode 将空格编码为加号"%20"

編碼:rawurlencode('http://www.h3399.cn/')

解碼:rawurldecode('http%3A%2F%2Fwww.h3399.cn%2F')






xxfseo.com