PHP gets the parameter resolution for the location specified in the URL

Source: Internet
Author: User
PHP gets the parameters at the specified location in the URL
PHP Gets the parameters for the location specified in the URL, because the parameters after the URL are variable. How to get it? such as www.xxx.com?act=game&st=play&b1=1&round=1, sometimes this URL will be output to www.xxx.com?act=game&st=play&b2=2 &round=1, of which B1, B2, B3 .... All the way to B15. How do i get the URL output of B1 or B2 or the other and his values?
------to solve the idea----------------------
outputting the query string to an array is fine.
------to solve the idea----------------------
Access by name
$s = ' www.xxx.com?act=game&st=play&b1=1&round=1 ';

Parse_str (@array_pop (Explode ('? ', $s)), $a);
Print_r ($a);

$s = ' www.xxx.com?act=game&st=play&b2=2&round=1 ';

Parse_str (@array_pop (Explode ('? ', $s)), $a);
Print_r ($a);
Array
(
[act] = Game
[St] = + Play
[B1] = 1
[Round] = 1
)
Array
(
[act] = Game
[St] = + Play
[B2] = 2
[Round] = 1
)

------to solve the idea----------------------
Parse_str
Http://www.w3school.com.cn/php/func_string_parse_str.asp
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.