Home >Backend Development >PHP Tutorial >javascript - 使用php获取一个通过JS跳转的最终网址

javascript - 使用php获取一个通过JS跳转的最终网址

WBOY
WBOYOriginal
2016-06-06 20:35:411897browse

地址为:http://prosperent.com/store/product/411677-18579-0/?k=CARDINAL+12132+E...

最终地址:http://www.walmart.com/ip/Cardinal-Brands-Inc-Clearvue-EasyOpen-Extra-...

使用的是这段JS跳转,无奈不懂JS,无从下手啊

<code>        var getParams = function()
        {
            var params = {};
            window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) {
                params[key] = value;
            });

            return params;
        };
</code>

回复内容:

地址为:http://prosperent.com/store/product/411677-18579-0/?k=CARDINAL+12132+E...

最终地址:http://www.walmart.com/ip/Cardinal-Brands-Inc-Clearvue-EasyOpen-Extra-...

使用的是这段JS跳转,无奈不懂JS,无从下手啊

<code>        var getParams = function()
        {
            var params = {};
            window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) {
                params[key] = value;
            });

            return params;
        };
</code>

getParams() 是把 url 里面的 querystring 提取出来,例如:

'?a=1&b=2' => { a: '1', b: '2' }

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn