伙计们,我如何http://example.com?hashval=1375336351_846b1b2aaf64b3ebe493a848e1f07585
在使用正则表达式解码 URL 后提取内容?以下是我解码前的 URL 值。
value="netstreambasepath=http%3A%2F%2Fwww.example.com%2Fhome%2FPlayer.aspx%3Flpk4%3D122943%26playChapter%3DFalse&id=ucPlayerNew_obj&file=http%3A%2F%2Ffiles2.example.com%2Fsecure%2Fcontent%2F105371%2Ff4v_H264%2Fsample1.f4v%3Fhashval%3D1375336351_846b1b2aaf64b3ebe493a848e1f07585&cname=Up%20and%20Running%20with%20sample%20sample2&vname=Sample1%20Sample1&cId=105371&vId=122943&type=video&autostart=true&start=0&volume=95&controlbar.position=none&display.icons=false"
我当前解码 url 的脚本如下:
<script type="text/javascript">
function encode() {
var obj = document.getElementById('dencoder');
var unencoded = obj.value;
obj.value = encodeURIComponent(unencoded).replace(/'/g,"%27").replace(/"/g,"%22");
}
function decode() {
var obj = document.getElementById('dencoder');
var encoded = obj.value;
obj.value = decodeURIComponent(encoded.replace(/\+/g, " "));
}
</script>
谢谢