分割网址/链接/url变量

<?php
$s = 'http://item.taobao.com/item.htm?id=16866631720&ali_trackid=2:mm_1463_0_0:1357875437_410_201055913&spm=2014.1';

parse_str(substr($s, strpos($s, '?')+1), $ar);
print_r($ar);
?>

将得到:

Array
(
    [id] => 16866631720
    [ali_trackid] => 2:mm_1463_0_0:1357875437_410_201055913
    [spm] => 2014.1
)

posted @ 2013-01-18 10:50  tinyphp  Views(1925)  Comments(0Edit  收藏  举报