Jcart Object(
[config] => Array
(
[jcartPath] => jcart/
[checkoutPath] => checkout.php
[item] => Array
(
[id] => my-item-id
[name] => my-item-name
[price] => my-item-price
[qty] => my-item-qty
[url] => my-item-url
[add] => my-add-button
)
[paypal] => Array
(
[id] => seller_1282188508_biz@conceptlogic.com
[https] => 1
[sandbox] =>
[returnUrl] =>
[notifyUrl] =>
)
[currencyCode] => USD
[csrfToken] =>
[text] => Array
(
[cartTitle] => Shopping Cart
[singleItem] => Item
[multipleItems] => Items
[subtotal] => Subtotal
[update] => update
[checkout] => checkout
[checkoutPaypal] => Checkout with PayPal
[removeLink] => remove
[emptyButton] => empty
[emptyMessage] => Your cart is empty!
[itemAdded] => Item added!
[priceError] => Invalid price format!
[quantityError] => Item quantities must be whole numbers!
[checkoutError] => Your order could not be processed!
)
[button] => Array
(
[checkout] =>
[paypal] =>
[update] =>
[empty] =>
)
[tooltip] => 1
[decimalQtys] =>
[decimalPlaces] => 1
[priceFormat] => Array
(
[decimals] => 2
[dec_point] => .
[thousands_sep] => ,
)
)
[items] => Array
(
[0] => 3
[1] => poslaju
)
[names] => Array
(
[3] => Hockey Stick
[poslaju] => Pos Laju
)
[prices] => Array
(
[3] => 33.25
[poslaju] => 6.00
)
[qtys] => Array
(
[3] => 1
[poslaju] => 3
)
[urls] => Array
(
[3] => http://bing.com
[poslaju] =>
)
[subtotal] => 51.25
[itemCount] => 4
)
我正在使用print_r($jcart)
来获取上述结果。
我只想打印出[qtys]
数组。我试过print_r($qtys);
,但它没有用。
答案 0 :(得分:1)
您必须引用数组元素。所以你总是需要指向$jcart
,然后从那里引用。正如谢尔盖指出的那样,你有一个对象
Jcart对象
所以你必须引用对象的元素,而不是数组
print_r($jcart->qtys);
答案 1 :(得分:1)
使用引用键选择您需要的特定元素。
echo '<pre>'; print_r($jcart->qtys);
只添加 <pre>
标记以更好的格式查看数组