Content issue

I want to:

greeting/102/steve =>  greeting/index/102/steve

in greeting.php:

function index($order,$name)
{
    echo "order: $order , name : $name ! ";
}    

in route.php:

$route['greeting/(:num)/(:any)'] = "greeting/index/$1/$2";    

Result:

order : , name : steve !
+3
source share
2 answers

In fact, use double quotes on the right . He even pointed it out in the manual (besides having done it a hundred times), so I don’t see the problem @cwallenpool points out.
Your routing looks fine, make sure it gets called after reserved routes

$route['default_controller'] = "welcome";
$route['404_override'] = '';
$route['greeting/(:num)/(:any)'] = "greeting/index/$1/$2";

.
I suggest you try using $this->uri->rsegment(n)(info on user guide here ) to catch the adjusted uri segment that is causing you problems. (similar $this->uri->segment(n), but designed specifically for redirected URIs)

$config['uri_protocol'] AUTO PATH_INFO ( ) , . , 'index.php' $config['index_page'], htaccess index.php URL.

+3

All Articles