JQuery中
编码
var url = 'folder/index.html?param=#23dd&noob=yes'; var encodedUrl = encodeURIComponent(url);
解码
var url = 'folder%2Findex.html%3Fparam%3D%2323dd%26noob%3Dyes'; var decodedUrl = decodeURIComponent(url);
php中
$str=urlencode ($url );//编码 $url=urldecode($str);//解码