使用javascript的decodeURIComponent函數解碼查詢字符串時,處理不了"+"
var q = '' decodeURIComponent(q.replace(/\+/g, '%20'))
即在調用decodeURIComponent函數之前要先把+替換為%20,這樣就沒有問題了
摘自:http://outofmemory.cn/code-snippet/3585/fix-js-decodeURIComponent-plus-issue
使用javascript的decodeURIComponent函數解碼查詢字符串時,處理不了"+"
var q = '' decodeURIComponent(q.replace(/\+/g, '%20'))
即在調用decodeURIComponent函數之前要先把+替換為%20,這樣就沒有問題了
摘自:http://outofmemory.cn/code-snippet/3585/fix-js-decodeURIComponent-plus-issue
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。