laravel - 如何在 Laravel 的命名路由中传递参数
问题描述
我想在我的刀片模板中传递url中的参数,url是:
href="/finance/invoices/download/{{ $invoice->file_path }}
在 web.php 中,路由定义为:
Route::get('invoices/download/{year}/{month}/{file}','InvoiceController@download')->name('download');
并且文件在数据库中存储为:
2018/07/invoiceberry_invoice_template_1.docx
我该怎么做?
解决方案
要添加到先前的答案,请执行以下操作:
route('download',['year' => $year, 'month' => $month, 'file' => $file]);
推荐阅读
- excel - 是否可以使用 VBA 使条件格式框变大?如果有怎么办?
- ios - 具有大量数据 Swift 的 CollectionView
- lorenz-system - Python Nolds:如何为 Lorenz 系统获得适当的值
- python - 如何使用 append 在 Python 中的循环中存储值
- wordpress - svg href 破碎的图像 wordpress elementor
- stateflow - 读出状态机的状态
- sql - Delphi SQL如何将数据添加到MS Access数据库表中的特定记录中
- android - Android:活动导航循环 - 保留内存堆栈
- wordpress - wordpress - 更改元标记在头部的显示位置
- javascript - 难以找到值的总和