Welcome Guest, Not a member yet? Register   Sign In
Route help
#1

[eluser]Unknown[/eluser]
Hi, All

I meet a problem here

actually, I wrote

Code:
$route['search/:any'] = "search/l/$1";

in the route.php

and also I have search controller with l as function

here's the l function detail

Code:
function l($keyword)
        {
            print_R($keyword);
        }

when I have my url to access as

Code:
http://127.0.0.1/search/l/test

I assume the keyword would get the value as "test"

However, it shows

Code:
$1

when I try to change the route.php as

Code:
$route['search/(:num)'] = "search/l/$1";

and access that url again

Code:
http://127.0.0.1/search/l/test

now it shows

Code:
test

it's pretty confused me as the document said

:num will match a segment containing only numbers.
:any will match a segment containing any character.

how can the :num match the words test ?
but also :any only shows $1 and not a var value

is it a bug ?

Thanks

-Howard




Theme © iAndrew 2016 - Forum software by © MyBB