CodeIgniter: passing method parameters when using "enable_query_strings"

I have enabled the use of query strings by setting the config variable "enable_query_strings" = TRUE.

I understand that in order to invoke method X of class Y, my URL will look like this:


However, what if my function signature for X is

function X($param1, $param2) {...}

how should my query string look like in order to pass two parameters to X()?

(Btw, I have decided to use this approach, because I couldn't find an article/forum on mod_rewrite for removing index.php that would work on my machine. I'm using XAMPP on a Windows platform)




It seems that if you want to use "enable_query_strings" = TRUE, you cannot pass parameters to function X().

This is what is says in the user guide

Please note: If you are using query strings you will have to build your own URLs, rather than utilizing the URL helpers (and other helpers that generate URLs, like some of the form helpers) as these are designed to work with segment based URLs.

To get around this you'd have to do this:


function X()
   $param1 = $this->input->get('param1');
   $param2 = $this->input->get('param2');

You don't have to use query strings just because you can't remove index.php from the URL, you can use URL's like this: If you enable query strings in config.php and also set uri_protocol to "PATH_INFO" you can use both. Like this:

Your problem with getting mod_rewrite to work is probably related to the fact that you're running CI in a subdirectory. RewriteBase /ci_sample/ directly after RewriteEngine On should do the trick. :)

Need Your Help

BlendEffect with mask broken on Imaging SDK 3?

uwp lumia-imaging-sdk

i'm migrating an app from WP 8.1 to UWP ,so i'm moving to Lumia sdk 3 .

Track won't play even if track is streamable

api soundcloud

I'm using the soundcloud API and so far it was working fine until I hit this track: