购物车错误(LaravelShoppingcart) [英] Shopping Cart Error (LaravelShoppingcart)

查看:74
本文介绍了购物车错误(LaravelShoppingcart)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Laravel 5中使用Crinsane/LaravelShoppingcart.当我尝试向购物车中添加商品时,它将显示错误

I am using Crinsane/LaravelShoppingcart with Laravel 5. When I try to add items to Cart then it will display error

假设从不兼容的上下文中获取$ this,则不应静态调用非静态方法Gloudemans \ Shoppingcart \ Cart :: add().

Non-static method Gloudemans\Shoppingcart\Cart::add() should not be called statically, assuming $this from incompatible context

任何帮助您解决此问题的方法.

Any help for resolve this..

推荐答案

在您的PHP文件顶部添加以下行:

Add this line at the top of your PHP file:

use Cart;

代替此:

use Gloudemans\Shoppingcart\Cart;

这篇关于购物车错误(LaravelShoppingcart)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆