NIUCLOUD是一款SaaS管理后台框架多应用插件+云编译。上千名开发者、服务商正在积极拥抱开发者生态。欢迎开发者们免费入驻。一起助力发展! 广告
# 内容长度中间件 The Content Length Middleware will automatically append a`Content-Length`header to the response. This is to replace the`addContentLengthHeader`setting that was removed from Slim 3. This middleware should be placed on the center of the middleware stack so it gets executed last. > 内容长度中间件将自动向响应附加一个`Content-Length`标头。这是为了取代`addContentLengthHeader`设置从Slim 3删除。这个中间件应该放在中间件堆栈的中心,这样它才会最后执行。 ## Usage ~~~php <?php use Slim\Factory\AppFactory; use Slim\Middleware\ContentLengthMiddleware; require __DIR__ . '/../vendor/autoload.php'; $app = AppFactory::create(); $contentLengthMiddleware = new ContentLengthMiddleware(); $app->add($contentLengthMiddleware); // ... $app->run(); ~~~