getting variables from STRING url in php

后端 未结 5 2070
情深已故
情深已故 2021-01-20 11:34

If I have a url that looks like this, what\'s the best way to read the value

http://www.domain.com/compute?value=2838

I tried parse_u

5条回答
  •  北荒
    北荒 (楼主)
    2021-01-20 12:08

    $uri = parse_url($uri);
    parse_str($uri['query'], $params = array());
    

    Be careful if you use parse_str() without a second parameter. This may overwrite variables in your script!

提交回复
热议问题