I couldn't get the parameter value from url in codeigniter.
For instance: localhost/log/job/php
here log/
is my folder, job/
is my controller and php
is my parameter.
I want to get this parameter in controller 'job'. How can I do that?
You can use $this->uri->segment(n);
You need to do some changes in route in order to allow the code igniter to receive the parameter in your controller
$route['uri-(:any)/(:num)'] = "controller/function/$1/$2";
OR
$route['uri-(:any)'] = "controller/function/$1";
in your controller do some changes
<?php
if (!defined('BASEPATH'))
exit('No direct script access allowed');
class controller extends CI_Controller
{
function function($parameter1 = null, $parameter2 = null)
{
........
}
}
refer this http://www.codeigniter.com/userguide2/libraries/uri.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With