Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/252.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在php中列出多维数组?_Php_Arrays_Multidimensional Array - Fatal编程技术网

如何在php中列出多维数组?

如何在php中列出多维数组?,php,arrays,multidimensional-array,Php,Arrays,Multidimensional Array,我有以下数组: array(3) { ["status"]=> int(1) ["statusmsg"]=> string(2) "Ok" ["acct"]=> array(43) { [0]=> array(23) { ["startdate"]=> string(15) "10 Nov 01 02:46" ["plan"]=> string(10) "high_Basic" ["suspende

我有以下数组:

array(3) {
  ["status"]=>
  int(1)
  ["statusmsg"]=>
  string(2) "Ok"
  ["acct"]=>


  array(43) {
    [0]=>


 array(23) {
  ["startdate"]=>
  string(15) "10 Nov 01 02:46"
  ["plan"]=>
  string(10) "high_Basic"
  ["suspended"]=>
  int(0)
  ["theme"]=>
  string(2) "x3"
  ["shell"]=>
  string(29) "/usr/local/cpanel/bin/noshell"
  ["maxpop"]=>
  string(9) "unlimited"
  ["maxlst"]=>
  string(9) "unlimited"
  ["maxaddons"]=>
  string(9) "*unknown*"
  ["suspendtime"]=>
  NULL
  ["ip"]=>
  string(14) "174.142.90.148"
  ["maxsub"]=>
  string(9) "unlimited"
  ["domain"]=>
  string(13) "dominio.com"
  ["maxsql"]=>
  string(9) "unlimited"
  ["partition"]=>
  string(4) "home"
  ["maxftp"]=>
  string(9) "unlimited"
  ["user"]=>
  string(6) "user"
  ["suspendreason"]=>
  string(13) "not suspended"
  ["unix_startdate"]=>
  string(10) "1288586771"
  ["diskused"]=>
  string(2) "0M"
  ["maxparked"]=>
  string(1) "2"
  ["email"]=>
  string(22) "email"
  ["disklimit"]=>
  string(5) "1000M"
  ["owner"]=>
  string(4) "high"
}



  }
}
我该怎么进去呢

示例:
while(数组){echo“$domain
”;}

现在谢谢大家

已决定,谢谢大家

代码解决方案:

$JsonResponse = ConnGateWay();
$JsonResponseOk = json_decode($JsonResponse,true);


$arrayaacct = $JsonResponseOk['acct'];

foreach($arrayaacct as $item) {


echo $item['domain'];
echo "<br>";
  }
$JsonResponse=connggateway();
$JsonResponseOk=json_解码($JsonResponse,true);
$arrayaacct=$JsonResponseOk['acct'];
foreach($arrayaacct作为$item){
echo$item['domain'];
回声“
”; }
使用该功能。

使用该功能。

您是否尝试使用该功能


您是否尝试过foreach


我会这样做:

function work ($array)
{
    foreach ($array as $key => $element)
    {
        if (is_array ($element)
        {
            work ($element);
        }
        else
        {
             // do stuff with the key and element
        }
    }
}

我会这样做:

function work ($array)
{
    foreach ($array as $key => $element)
    {
        if (is_array ($element)
        {
            work ($element);
        }
        else
        {
             // do stuff with the key and element
        }
    }
}
你的数组有键。 您可以访问单个单元格,也可以遍历所有单元格。 例如:

array myArray(
“开始日期”=>“11月10日01:46”,
“计划”=>“高基础”,
“已暂停”=>0
);
echo myArray['plan'];//将打印:high_Basic
foreach(myArray作为$key=>$value){
echo$key;
回声“=”;
echo美元价值;
回声“
”; } /* 将打印: 起始日期=11月10日01:46 计划=高基础 暂停=0 */
你有什么具体的目标吗

Lavi

您的阵列具有密钥。 您可以访问单个单元格,也可以遍历所有单元格。 例如:

array myArray(
“开始日期”=>“11月10日01:46”,
“计划”=>“高基础”,
“已暂停”=>0
);
echo myArray['plan'];//将打印:high_Basic
foreach(myArray作为$key=>$value){
echo$key;
回声“=”;
echo美元价值;
回声“
”; } /* 将打印: 起始日期=11月10日01:46 计划=高基础 暂停=0 */
你有什么具体的目标吗


Lavi

我想这是你需要的

我想这是你需要的

不,我需要检查这个数组的所有行,打印出来吗?它只会显示在屏幕上,我真的需要一行一行地拾取,明白吗?不,我需要遍历这个数组的所有行,打印出来吗?它只是显示在屏幕上,我真的需要的是一行一行地拾取,明白吗?
array myArray(
    'startdate'=>'10 Nov 01 02:46',
    'plan'=>'high_Basic',
    'suspended'=>0
);

echo myArray['plan'];  // Would print:  high_Basic
foreach (myArray AS $key=>$value) {
    echo $key;
    echo "=";
    echo $value;
    echo "<br/>";
}
/*
Would print:
startdate=10 Nov 01 02:46
plan=high_Basic
suspended=0
*/