How to make a working url like this: example.com/controller/method?id=1&cat=2
相关问题
- How to use strip_tags with second parameter in Cod
- codeigniter replace array values in model
- How to access variables from other methods inside
- codeigniter $this->upload->do_upload() = false
- Forcing CodeIgniter to send view and stop working
相关文章
- Private static variables in php class
- GuzzleHttp Hangs When Using Localhost
- Codeigniter not logging
- Loading custom config file into a Codeigniter libr
- Loading and using a codeigniter model from another
- Integrate Bootstrap on CodeIgniter
- Showing correct response in Postman but wrong resp
- array_unique showing error Array to string convers
It is possible by setting
$config['enable_query_strings'] = TRUE;
in your config.php file (As DamienL answered). I just tried with a fresh CodeIgniter installation from here.However, it appears there must be at least 2 variables (separated with a "&") for it to work.
Here are the steps I took to make this happen:
In config.php, I changed
$config['base_url']
to the appropriate directory and set$config['enable_query_strings'] = TRUE;
In the controllers directory I created the following class:
I can then access the index function with a query string, but only if there are 2 or more variables like this:
If you absolutely need both the segment-based and query string-based approaches, but only need one variable in a particular query string, I suppose you could add a second "dummy" variable and just ignore it.