CakePHP 3 - Configure route to allow optional parameter
问题 I have a route like this: $routes->connect('/custom/url', [ 'prefix' => 'admin', 'controller' => 'Things', 'action' => 'index' ]); I want to allow an optional passed parameter so the URL can be /custom/url/123 but also still allow it to not have the parameter at all, like /custom/url . If I change the route to /custom/url/:param it throws an exception if I visit the URL without the extra parameter. How can I make the parameter matching lazy? 回答1: routes like: $routes->connect('/custom/url/*',