0
このセッションの行間をどのように反復して、私が欲しいものを得るのか分かりません。私はさまざまなアプローチを試みましたが、正しい結果を得られませんでした。テストのための PHPでネストされた配列を持つセッションの行をどのように反復するのですか?
foreach($this->session->data['cart'] as $key=>$row){
$this->cart->add($row['product_id'], $row['quantity'], $row['option'], $row['recurring_id'], $row['store_id']);
}
ORこの:あらゆる種類の助けを
foreach($this->session->data['cart']['row'] as $key=>$row){
print_r($row['product_id']);
print_r('<hr>');
}
Array
(
[num_rows] => 10
[row] => Array
(
[cart_id] => 126
[product_id] => 45
[recurring_id] => 0
[option] => {"90":["263"],"89":["260"]}
[quantity] => 2
[store_id] => 2
)
[rows] => Array
(
[0] => Array
(
[cart_id] => 126
[product_id] => 45
[recurring_id] => 0
[option] => {"90":["263"],"89":["260"]}
[quantity] => 2
[date_added] => 2017-11-08 21:19:56
[store_id] => 2
)
[1] => Array
(
[cart_id] => 127
[product_id] => 46
[recurring_id] => 0
[option] => {"90":["263"],"89":["261"]}
[quantity] => 1
[date_added] => 2017-11-08 21:19:56
[store_id] => 2
)...
感謝します。
@coderodour:同じことを。うまくいかなかった。 – Kardo
$ this-> session-> data ['cart'] 'の代わりに '$ this-> session-> data [' cart '] [' rows ']'を試してください – JTC