How to get and disect the query string appended into a url? PHP

后端 未结 6 1656
不知归路
不知归路 2021-01-22 04:53

I am trying to develop a PHP class which would enable me to get the query string appended into a url and process it according to the variables passed. How can this be done?

6条回答
  •  北恋
    北恋 (楼主)
    2021-01-22 05:38

    If you have the parameters stored in a variable, then use parse_str. Example:

    $str = 'var1=a&var2=b&var3=c';
    parse_str($str);
    echo $var1;
    

提交回复
热议问题