如何创建链接以下载 symfony2 中生成的文档?文档、链接

由网友(爱凡)分享简介:Documents are created by the system and saved to the folder /web/downloads. I have created a view to display links which will allow a user to download the files...

Documents are created by the system and saved to the folder /web/downloads. I have created a view to display links which will allow a user to download the files, should the user click the links. (standard click to download feature)

I am new to Symfony2 and am getting around the whole routing/controller concept, but how would one create a link to such files while still adhering to the MVC? Does one need to set up routing with a controller or does twig have features which allow it etc.

Pdf如何按照指定的页数进行拆分

PS: I have read questions such as How to create a download link in Symfony2? but i do not get if they did something in the routing or just added links etc.

Thank you,

解决方案

Let's make a sample.

Say your project lives in /www/, so /www/web/ is the document root of your symfony2 application. Now everything you try to access that is in /www/web/ over http://server/ will show up.

/www/web/downloads/file.zip would be reachable at http://server/downloads/file.zip by default.

阅读全文

相关推荐

最新文章