【问题标题】:Object of class Illuminate\Routing\Redirector could not be converted to int laravel类 Illuminate\Routing\Redirector 的对象无法转换为 int laravel
【发布时间】:2020-02-03 08:41:23
【问题描述】:

我想在一些操作后重定向用户以使用参数进行路由,我写了这样的东西

  return redirect()-route('purchaseList' , ['shop' => $shopName , 'id' => $productId]);

但是当它重定向它给我这个错误:

Illuminate\Routing\Redirector 类的对象无法转换为 int

btw $shopName 和 $productID 是存在的,问题不是这个

这是我的路线

Route::get('/{shop}/purchase-list/{id}', 'ShopController@purchaseList')->name('purchaseList');

【问题讨论】:

    标签: php laravel


    【解决方案1】:

    您应该更新重定向方法。

    return redirect()->route('purchaseList' , ['shop' => $shopName , 'id' => $productId]);
    

    你必须错过>

    【讨论】:

    • @hassankhosro 如果您的问题解决了。请接受并支持答案。很高兴为您提供帮助!
    猜你喜欢
    • 2019-11-12
    • 2016-06-01
    • 1970-01-01
    • 2021-11-08
    • 2019-06-27
    • 2019-01-28
    • 2021-08-15
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多