简体   繁体   中英

Get Data from Url

I used http build query to send data from URL The Url is in the following format :

http://www.abc.in/xyz/Tak-Wadi?0%5Bmerchant_location_id%5D=1&1%5Bmerchant_location_id%5D=2

Now How to get data ie. merchant_location_id 1 & 2.

This might help you.

echo $id1 = $_GET[0]['merchant_location_id'];
echo $id2 = $_GET[1]['merchant_location_id'];
$queryString = array();
foreach ($_GET as $key => $value) {
    $queryString[] = $key . '=' . $value;
}
$queryString = implode('&', $queryString);

For further assistance you can get reference from this weblink .

if you do the following:

$url = urldecode("http://www.abc.in/xyz/Tak-Wadi?0%5Bmerchant_location_id%5D=1&1%5Bmerchant_location_id%5D=2");

echo $url;

That will clear it up a bit:

http://www.abc.in/xyz/Tak-Wadi?0[merchant_location_id]=1&1[merchant_location_id]=2

Now, this url let's you know that you've got two arrays each containing one key ( merchant_location_id )

$_GET[0]
$_GET[1]

Now that we know this it's easy to retrieve the data.

echo $_GET[0]['merchant_location_id'];
echo $_GET[1]['merchant_location_id'];

That should be all there is to it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM