[英]tell how much data there is in a session in laravel
@foreach (count(Session::cart()) as $key => $cartItem)
//I need to know how many arrays are obtained from this session to use it in an if statement //我需要知道从该会话中获得了多少个数组,才能在if语句中使用它
@if(count($_SESSION['cart']) > 1)
//I try it but its not work
You may do like this. 您可能会这样。
@if(count($_SESSION['cart']) > 0)
@foreach ($_SESSION['cart'] as $key => $cartItem)
//write your code here
@endforeach
@endif
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.