Welcome Guest, Not a member yet? Register   Sign In
change GET query string
#4

I'm not sure if this is what you want, but you can use codeigniter ability to parse uri
uri_to_assoc();
http://whatever.com/brand/foo/model/bar
(
        'brand' => 'foo',
        'model' => 'bar',
)

assoc_to_uri()
(
        'brand' => 'foo',
        'model' => 'bar',
)
http://whatever.com/brand/foo/model/bar
assoc_to_uri()
(
        'model' => 'bar',
)
http://whatever.com/model/bar

But if you really need exactly the query string, there could be 'http_build_query()' usefull for you.
When you build response, just create array of parameters and uset all 'empty' keys. Then 'http_build_query()' should create query without 'brand' if it is empty.
Reply


Messages In This Thread
change GET query string - by neuron - 01-24-2017, 02:18 AM
RE: change GET query string - by Khanh Minh - 01-24-2017, 03:04 AM
RE: change GET query string - by neuron - 01-24-2017, 03:28 AM
RE: change GET query string - by Sezu - 01-25-2017, 01:47 AM
RE: change GET query string - by neuron - 01-25-2017, 03:58 AM
RE: change GET query string - by Sezu - 01-25-2017, 05:52 AM
RE: change GET query string - by neuron - 01-25-2017, 06:35 AM
RE: change GET query string - by Sezu - 01-25-2017, 06:52 AM
RE: change GET query string - by salain - 01-25-2017, 07:07 AM
RE: change GET query string - by neuron - 01-25-2017, 07:23 AM
RE: change GET query string - by Wouter60 - 01-26-2017, 03:29 AM
RE: change GET query string - by ivantcholakov - 01-26-2017, 04:25 AM



Theme © iAndrew 2016 - Forum software by © MyBB