PHP Parse URL From Current URL

前端 未结 6 947
被撕碎了的回忆
被撕碎了的回忆 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:04

    You can use parse_str() function.

    $url = "www.mysite.com/register/?email=admin";
    $parts = parse_url($url);
    parse_str($parts['query'], $query);
    echo $query['email'];
    

提交回复
热议问题