get request url parameter a problem +, space, =,%, &, # special symbols like solution

url + has appeared, space, /,?, when the%, #, &, = and other special symbols, may not get the correct parameter values on the server side, what to do?
Solutions to
these characters transformed into the server can recognize characters, correspondence is as follows:
the URL of character escape

Replace it with other characters, or with a full-width.

+ The URL + sign indicates a space% 2B   
spaces in the URL box can use the + or coding% 20 
/ to separate directories and subdirectories% 2F     
? Separated the actual URL and parameters% 3F     
% Specifies the special characters% 25     
# Indicates bookmark% 23     
& separator between the parameters specified in the URL 26%     
= value specified in the URL parameter% 3D

 

For example, I am here to do a SSO function

 

http://127.0.0.1:8080/mgWeb/login.do?type=jxemisLogin&url=http://localhost:8080/shop/admin/jxncOrder!qryOrderDetail.do?order_id=17347001822420000002&is_timeout=&is_history=no&staffId=******

 

url=http://localhost:8080/shop/admin/jxncOrder!qryOrderDetail.do?order_id=17347001822420000002&is_timeout=&is_history=no

 

url = & containing symbols

 

26% may be used alternatively & 

 

After the change:

 

http://127.0.0.1:8080/mgWeb/login.do?type=jxemisLogin&url=http://localhost:8080/shop/admin/jxncOrder!qryOrderDetail.do?order_id=17347001822420000002%26is_timeout=%26is_history=no&staffId=******

 

url=http://localhost:8080/shop/admin/jxncOrder!qryOrderDetail.do?order_id=17347001822420000002%26is_timeout=%26is_history=no

The special symbols to replace

var str = 'Temple # 101. 3';
var str.replace Result = (/ # / G, '% 23 is');
the console.log ( 'Result:' Result +);
 
---------- ------
Disclaimer: this article is the original article CSDN bloggers "weixin_41655541", and follow CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/weixin_41655541/article/details/93507395

Guess you like

Origin www.cnblogs.com/chenqingbin/p/11511833.html