А
Size: a a a
А
DS
class AppRouterFactory
{
public function __invoke(ContainerInterface $container)
{
$routes = [
Route::get('/test', [SiteController::class, 'test2'])->name('test')
];
$router = (new RouterFactory(new FastRouteFactory(), $routes))($container);
$router->setUriPrefix('/admincp');
return $router;
}
}
public function test2(RouterInterface $router, ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$response = $this->responseFactory->createResponse();
$response->getBody()->write($router->generate('test'));
return $response;
}
http://localhost:8080/test
/admincp/test
DS
$response->getBody()->write($router->generate($router->getCurrentRoute()->getName()));
DS
А
DS
А
DS
А
DS
А
А
А
Д
DS
DS
Д
DS
А
Д