You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Derek Jones edited this page Jul 5, 2012
·
12 revisions
By default CodeIgniter's $_GET is unset. What do you do if you want to have the ease of query strings and uri segments at the same time, without having to optionary enable query strings? Try this simple helper function.
Create a simple helper and call it request. Use this function:
functiongetRequests()
{
//get the default object $CI =& get_instance();
//declare an array of request and add add basic page info $requestArray = array();
$requests = $CI->uri->segment_array();
foreach ($requestsas$request)
{
$pos = strrpos($request, ':');
if($pos >0)
{
list($key,$value)=explode(':', $request);
if(!empty($value) || $value='') $requestArray[$key]=$value;
}
}
return$requestArray ;
}