我想制作一条直接访问文档的路线。例如,我想domain/file/document.pdf
通过domain/doc
.
我试过这个:
$app->get('/docs/v1', function ($request, $response){
$this->view->render( $response, '/docs/document.pdf');
});
但它不起作用。我也在官方文档上看到了这个:
$app = new \Slim\App();
$app->get('/hello', function ($req, $res) {
$this['view']->display('profile.html', [
'name' => 'Josh',
'url' => 'https://joshlockhart.com'
]);
});
但显示功能不存在。
Fatal error: Call to undefined method Slim\Views\PhpRenderer::display()
也许我错过了一些东西,我不知道,我没有在文档中找到任何其他内容。
谢谢!