PHP Parse URL From Current URL

前端 未结 6 948
被撕碎了的回忆
被撕碎了的回忆 2021-01-29 05:38

I am trying to parse url and extract value from it .My url value is www.mysite.com/register/?referredby=admin. I want to get value admin from this url.

6条回答
  •  执笔经年
    2021-01-29 06:06

    Try this code,

    $url = "www.mysite.com/register/?referredby=admin";
    $parse = parse_url($url, PHP_URL_QUERY);
    parse_str($parse, $output);
    echo $output['referredby'];

提交回复
热议问题