我正在尝试使用 zend 表达嵌套应用程序,所以我正在关注这篇博文: https ://framework.zend.com/blog/2017-03-15-nested-middleware-in-expressive.html
问题似乎出在中间件工厂:
class CreateBookMiddlewareFactory
{
public function __invoke(ContainerInterface $container)
{
$nested = new Application(
$container->get(RouterInterface::class),
$container
);
$nested->pipe(AuthenticationMiddleware::class);
$nested->pipe(ContentValidationMiddleware::class);
$nested->pipe(BodyParamsMiddleware::class);
$nested->pipe(BookValidationMiddleware::class);
$nested->pipe(CreateBookMiddleware::class);
return $nested;
}
}
我不明白CreateBookMiddleware
我们在其工厂中如何将其添加到此处的管道中。所以管道它将调用工厂,创建一个新的嵌套应用程序,它将调用工厂,这将创建另一个嵌套应用程序......
( ! ) Fatal error: Maximum function nesting level of '256' reached, aborting! in /var/www/project/vendor/zendframework/zend-stratigility/src/Next.php on line
158
这篇博文中有什么我没有得到正确的东西吗?