嗨,我有多维数组:
Array
(
[0] => Array
(
[name] => uzsakymas
[value] => title
)
[1] => Array
(
[name] => preke
[value] => name
)
[2] => Array
(
[name] => kaina
[value] => 5
)
[3] => Array
(
[name] => kiekis
[value] => 1
)
[4] => Array
(
[name] => preke
[value] => name2
)
[5] => Array
(
[name] => kaina
[value] => 5
)
[6] => Array
(
[name] => kiekis
[value] => 5
)
)
但是当我尝试获取添加到 mysql 的值时,我得到了一个错误。我做错了什么?
$json = json_decode($_POST['json'], true);
print_r($json);
foreach($json as $key => $name) {
echo $name['preke'];
}
未定义的索引:preke in...