const urlCodeStr = encodeURIComponent(string).replace(/%20/gi, '').replace(/(!)|(')|(\()|(\))|(\~)/gi, item => {
return '%' + item.charCodeAt(0).toString(16).toLocaleUpperCase();
});
const urlCodeStr = encodeURIComponent(string).replace(/%20/gi, '').replace(/(!)|(')|(\()|(\))|(\~)/gi, item => {
return '%' + item.charCodeAt(0).toString(16).toLocaleUpperCase();
});
本文标题:JS模拟php的urlencode()
本文链接:https://www.haomeiwen.com/subject/esfifctx.html
网友评论