Ext.urlEncode与Ext.urlDecode
Ext.urlEncode与Ext.urlDecode:
用于js对象和查询字符串之间的相互转换
Ext.urlEncode例子如下:
1 /* 2 Ext.urlEncode( object, [recursive] ) 3 将一个js对象编码为查询字符串 4 */ 5 Ext.urlEncode({birth:{year:1991,month:05,day:07}},true); 6 7 Ext.urlEncode({colors:['red','green','blue']});//可以加上true 8 9 Ext.urlEncode({hobbies:['coding','eating','sleeping',['nested','stuff']]},true);
Ext.urlDecode例子如下:
1 /* 2 urlDecode( queryString, [recursive] ) 3 将一个查询字符串解码为js对象 4 */ 5 //第二个递归参数:主要用于解决对象和数组的解码问题 6 Ext.urlDecode('birth[year]=1991&birth[month]=05&birth[day]=07') 7 8 Ext.urlDecode('hobbies[0]=reading&hobbies[1]=write&hobbies[2]=coding') 9 10 Ext.urlDecode('hobbies[0]=coding&hobbies[1]=eating&hobbies[2]=sleeping&hobbies[3][0]=gaming&hobbies[3][1]=traveling') 11 12 13 14 Ext.urlDecode('birth[year]=1991&birth[month]=05&birth[day]=07',true) 15 16 Ext.urlDecode('hobbies[0]=reading&hobbies[1]=write&hobbies[2]=coding',true) 17 18 Ext.urlDecode('hobbies[0]=coding&hobbies[1]=eating&hobbies[2]=sleeping&hobbies[3][0]=gaming&hobbies[3][1]=traveling',true)