I have been having trouble storing an array in session. I am making a shopping cart and it doesn't seem to work.
public function __construct(){
$product = array(1,2,3,4);
Session::push('cart', $product);
}
然后像这样在视图中检索它.
{{Session::get('cart')}}
然而,我总是遇到这样的错误.
htmlentities() expects parameter 1 to be string, array given
有关如何创建存储一系列商品的购物车的任何线索和建议.