我是一个阵列:
Array
(
[_edit_lock] => Array
(
[0] => 1434971582:11
)
[_edit_last] => Array
(
[0] => 11
)
[_wp_page_template] => Array
(
[0] => page-templates/langenfeldDreiSpalterMitSiderbarsRL.php
)
[_wpas_done_all] => Array
(
[0] => 1
)
[hefo_before] => Array
(
[0] => 0
)
[hefo_after] => Array
(
[0] => 0
)
[sharing_disabled] => Array
(
[0] => 1
)
[spacious_page_layout] => Array
(
[0] => left_sidebar
)
[_thumbnail_id] => Array
(
[0] => 2641
)
[ort] => Array
(
[0] => langenfeld
)
)
我想保存" ort"在变量中。
[ort] => Array
(
[0] => langenfeld
)
我的代码给了我数组的值但是如何保存值? 我的代码:
foreach ($gpc as $k){
foreach ($k as $v){
//echo $v;
}
}
我认为是这样的:
$ort = $v['ort'];
但那不适合我。有人可以帮忙吗?
答案 0 :(得分:0)
此代码正常运行
$arr = Array
(
'_edit_lock' => Array
(
'0' => "1434971582:11",
),
'_edit_last' => Array
(
'0' => "11",
),
'_wp_page_template' => Array
(
'0' => "page-templates/langenfeldDreiSpalterMitSiderbarsRL.php",
),
'_wpas_done_all' => Array
(
'0' => "1",
),
'hefo_before' => Array
(
'0' => "0",
),
'hefo_after' => Array
(
'0' => "0",
),
'sharing_disabled' => Array
(
'0' => "1",
),
'spacious_page_layout' => Array
(
'0' => "left_sidebar",
),
'_thumbnail_id' => Array
(
'0' => "2641",
),
'ort' => Array
(
'0' => "langenfeld",
),
);
$ort = $arr["ort"];
print_r($ort);
//输出
Array
(
[0] => langenfeld
)
如果你直接想要langenfeld
$ort = $arr['ort'][0];
//这将输出 - langenfeld