数组如下所示:
$_ADMINLANG['global']['jumppage'] = "Jump to Page";
$_ADMINLANG['global']['go'] = "Go";
$_ADMINLANG['months']['january'] = "January";
$_ADMINLANG['months']['february'] = "February";
.......
现在,我想输出以上数据:
$_ADMINLANG['global']['jumppage'] =
$_ADMINLANG['global']['go'] =
$_ADMINLANG['months']['january'] =
"Jump to Page";
"Go";
"January";
我该怎么办?谢谢。
答案 0 :(得分:0)
循环遍历数组并回显键(第一个输出),第二个输出回显值。
查看foreach函数:http://php.net/manual/en/control-structures.foreach.php
答案 1 :(得分:0)
http://www.php.net/manual/en/function.array-keys.php - 返回数组的键
http://www.php.net/manual/en/function.array-values.php - 返回数组的值
答案 2 :(得分:0)
我真的不知道这是否只是关于输出数组内容,但如果是,那么你去:
$_ADMINLANG['global']['jumppage'] = "Jump to Page";
$_ADMINLANG['global']['go'] = "Go";
$_ADMINLANG['months']['january'] = "January";
$_ADMINLANG['months']['february'] = "February";
foreach ($_ADMINLANG as $sub) {
foreach ($sub as $key => $val) {
echo $val, '<br />';
}
}
答案 3 :(得分:0)
如果您想简单地打印您提到的值,那么这必须是代码。
$temp = '';
foreach ($_ADMINLANG as $key1 => $arr) {
foreach ($arr as $key2 => $val) {
echo '$_ADMINLANG["'.$key1.'"]["'.$key2.'"] = <br />';
$temp .= $val.'<br/>';
}
}
echo $temp;