如何将变量传递到文件路径 ini php

How to pass variable into file path ini php

我正在尝试将 $namefile 传递到路径下载中。怎么做?

public function download($namefile)
        {
            
            return $this->response->download("pathfile/[here]", null);
        }

我正在使用标签下载文件

<label>File <a href="/suratmasuk/download/<?= $surat['file']; ?>"><sup>Download</sup></a></label>

您是否正在尝试使用按钮下载文件? 如果是,为什么不在按钮 href 中使用 <?php base_url()/[file location] ?>