Welcome Guest, Not a member yet? Register   Sign In
Please explain the router code.
#1

I can't think of a case where this code would make sense.

PHP Code:
$replacekey str_replace('/(.*)'''$routeKey);
$handler    preg_replace('#^' $routeKey '$#u'$handler$uri);
$handler    str_replace($replacekeystr_replace('/''\\'$replacekey), $handler); 

PHP Code:
// for route 
$routes->get('path/(:segment)/(:any)''Controller::method/$1/$2');

// $routeKey = path/([^/]+)/(.*)
$replacekey str_replace('/(.*)'''$routeKey); // path/([^/]+)

$handler    preg_replace('#^' $routeKey '$#u'$handler$uri);  // \App\Controllers\Controller::method/1/2

$handler    str_replace($replacekeystr_replace('/''\\'$replacekey), $handler); // replacing "path/([^/]+)" with "path\([^\]+)" in "\App\Controllers\Controller::method/1/2" 
Reply


Messages In This Thread
Please explain the router code. - by iRedds - 05-15-2022, 10:00 PM
RE: Please explain the router code. - by kenjis - 05-16-2022, 08:33 PM
RE: Please explain the router code. - by iRedds - 05-16-2022, 08:55 PM
RE: Please explain the router code. - by kenjis - 05-16-2022, 09:05 PM



Theme © iAndrew 2016 - Forum software by © MyBB