Home  >  Article  >  Backend Development  >  这个foreach该怎么写?

这个foreach该怎么写?

WBOY
WBOYOriginal
2016-06-23 14:24:291032browse

表单提交了2组数组过来:
array(2) {
  ["goods_id1"]=>
  array(2) {
    [0]=>
    string(9) "www.1.com"
    [1]=>
    string(7) "商品1"
  }
  ["goods_id2"]=>
  array(2) {
    [0]=>
    string(9) "www.2.com"
    [1]=>
    string(7) "商品2"
  }
}

怎样把 goods_id1 和 goods_id2 用foreache输出成这样:
商品1
商品2

foreach($_POST as $key => $value)
{
这里应该怎么写?
}


回复讨论(解决方案)

foreach($_POST as $key => $value)
{
  echo "$value[1]";

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn