how to read query string from a URL in PHP

前端 未结 3 2007
慢半拍i
慢半拍i 2021-01-24 14:26

If the URL is https://www.mohsin.com?main=17&street=71, then what is the PHP code to grab the \"main\" and \"street\" values?

I am expecting line of codes written in

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-24 15:01

    $main = $_GET['main'] will get the main variable and $street = $_GET['street'] will get the street variable. All URL parameters are loaded into the PHP $_GET super global array and the super global is an associative array.

提交回复
热议问题