从特定子数组中提取数据[重复]

问题描述 投票:0回答:1

我在这里度过了一个高级时刻

我有以下数组,我正在尝试从“[0]”中获取数据

Array (
  [ID] => 103088
  [key] => field_65002d05c4f14
  ... more elements
  [value] => Array (
    [0] => Array (
      [file_title] => Spec Sheet - with contents
      [file] => URL
    )
  )
  ... more elements
)

我已经完成了我的

foreach
循环,但是我没有得到任何输出 - WordPressfunctions.php

foreach($arrayOBJ as $value => $file){

        //echo '<li><a href="'.$file['file'].'"></a>Some Text</li>';
        }

我希望能够生成以“文件”作为 href 和一些文本作为文本的行

php arrays foreach
1个回答
0
投票

用途:

foreach($arrayOBJ['value'] as $file){
  //echo '<li><a href="'.$file['file'].'"></a>Some Text</li>';
}
© www.soinside.com 2019 - 2024. All rights reserved.