Welcome Guest, Not a member yet? Register   Sign In
Route error when the value is greater than 9
#1

My configuration:

Code:
$routes->group('members', ['namespace' => 'App\Controllers'], function ($routes) {
    $routes->get('/', 'Members::index');
    $routes->add('(:any).(:num)/aaa', 'Members::aaa/$1.$2');
});
My link: https://domain.com/members/abcdef.13/aaa
When "(:num)" is less than 10, it's true.
When "(:num)" is greater than or equal to 10, it's false.
Reply
#2

I'm on my phone commuting so I'm just guessing: I think the route function should be defined as Members::aaa/$1/$2 so you pass the (:num) segments as two arguments properly.
Reply
#3

(This post was last modified: 01-20-2021, 11:53 PM by zoom360.)

(01-20-2021, 11:40 PM)tgix Wrote: I'm on my phone commuting so I'm just guessing: I think the route function should be defined as Members::aaa/$1/$2 so you pass the (:num) segments as two arguments properly.
This is function in Controller:

Code:
public function aaa($slug = '')
{
    /* I will get slug = (:any).(:num)
}
I'll get value (:any).(:num).
Reply
#4

Add a backslash before the dot between (:any) and (:num)
(:any)\.(:num)
Reply
#5

(01-21-2021, 12:47 AM)iRedds Wrote: Add a backslash before the dot between (:any) and (:num)
(:any)\.(:num)
Thanks @iRedds !
It's work!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB