php - 类 Illuminate\Routing\Redirector 的对象无法转换为 int laravel
问题描述
我想在一些操作后重定向用户以使用参数进行路由,我写了这样的东西
return redirect()-route('purchaseList' , ['shop' => $shopName , 'id' => $productId]);
但是当它重定向时,它给了我这个错误:
类 Illuminate\Routing\Redirector 的对象无法转换为 int
顺便说一句 $shopName 和 $productID 是存在的,问题不是这个
这是我的路线
Route::get('/{shop}/purchase-list/{id}', 'ShopController@purchaseList')->name('purchaseList');
解决方案
您应该更新重定向方法。
return redirect()->route('purchaseList' , ['shop' => $shopName , 'id' => $productId]);
你必须错过>
。
推荐阅读
- sql - 根据另一个表中的条目数在一个表中设置一个值
- python - 如何获得具有偶数/奇数/第 k 行总和的新列?
- c++ - + 运算符重载错误,即使它已重载
- python - 将 streamlit 应用程序转换为 pyinstaller 可执行文件
- python - 使用 git 为 heroku 上的 django 应用程序更新特定文件
- php - 如何从 .env 文件中获取键的值?
- python - python生成器的源代码在哪里发送?
- html - #checkbox:checked ~ item 在带有 css 的 html 网页中什么都不做
- typescript - rxjs last() 如何工作?
- flutter - 如何在不影响布局的情况下增加 Container 的大小?