Home > Backend Development > PHP Tutorial > 如何在这种网址里面拿到id的参数呢

如何在这种网址里面拿到id的参数呢

WBOY
Release: 2016-06-13 12:56:00
Original
945 people have browsed it

怎么在这种网址里面拿到id的参数呢?
http://item.taobao.com/item.htm?id=16866631720&ali_trackid=2:mm_1463_0_0:1357875437_410_201055913&spm=2014.1

这是淘宝的链接,怎样拿到里面的id参数呢?,位置不一定在那的


------解决方案--------------------
$s = 'http://item.taobao.com/item.htm?id=16866631720&ali_trackid=2:mm_1463_0_0:1357875437_410_201055913&spm=2014.1';<br />
<br />
parse_str(substr($s, strpos($s, '?')+1), $ar);<br />
print_r($ar);
Copy after login
Array
(
    [id] => 16866631720
    [ali_trackid] => 2:mm_1463_0_0:1357875437_410_201055913
    [spm] => 2014.1
)
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template