【发布时间】:2016-10-03 06:28:47
【问题描述】:
我在 Magento2 中创建了简单的自定义模块。现在正确显示页面我需要在该页面上创建链接,该链接下载模块 web 文件夹中的 PDF 文件。
对于 Ex app\code\Magento\Hello\view\frontend\web\pdf\test.pdf
我该怎么办?如果是的话,我是否需要为新功能添加路由,目前我的路由文件是如何做到的
\app\code\Magento\Hello\etc\frontend\routes.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="hello" frontName="hello">
<module name="Magento_Hello"/>
</route>
</router>
</config>
其余文件是简单的模块文件,没有修改。
请让我知道我需要在哪里编写链接的下载代码
谢谢。
【问题讨论】:
-
答案请参考 Magento stackexchange 上的问题:magento.stackexchange.com/questions/118226/…