【发布时间】:2023-03-19 09:11:01
【问题描述】:
我有一个数组,我想在其中获取特定值(“已创建”),然后将 $_SESSION 存储在一个新数组中。我怎样才能做到这一点?
我的数组是这样的
Array
(
[0] => Array
(
[product_id] => 679
[quantity] => 1
[created] => 2018-10-01
)
[1] => Array
(
[product_id] => 677
[quantity] => 1
[created] => 2018-10-05
)
[2] => Array
(
[product_id] => 678
[quantity] => 1
[created] => 2018-10-03
)
)
我尝试了类似的方法:
foreach($created as $i) {
$values = [$i]['created'];
echo $values;
}
session_start();
$_SESSION['creation_dates'] = $values;
但这不起作用。
谁能帮帮我?
【问题讨论】: