$shopcart_book_name字串这里需要用.为加的意思
如果foreach的值为字串以+的方式使用会为0
$shopcart_price数字需要用+,
如使用.会以字串的方式去加,如1+1会等于11
在js的世界+是通用的..
$shopcart_book_name;$shopcart_price;foreach ($shopcart as $key => $shopcarts) {$shopcart_book_name = $shopcart_book_name .' '. $shopcarts['book_name'];$shopcart_price = $shopcart_price + $shopcarts['price'];}