- parse_str: documentation ( source)
- urldecode: documentation ( source)
- parse_url: documentation ( source)
<?php
// Everything you enter here will be executed by our servers. Try it!
function get_url_arg( $url,$arg='' ) {
$url = urldecode( $url );
$args = parse_url( $url, PHP_URL_QUERY );
parse_str( $args, $result );
if($arg)
return $result[$arg];
return $result;
}
$url = 'http://click.union.jd.com/statistic/statisticClick.action?unionId=18550&t=1&to=http://item.jd.com/634519.html';
echo get_url_arg($url,'to');