存储foreach导致多维数组

时间:2017-04-01 15:45:00

标签: php ebay-api

我试图在数组

中存储来自foreach循环的值
$result_itemid = array();
foreach($resp->searchResult->item as $item) {
   $itemid = $item->itemId;
   $title = $item->title;
   $result_itemid[] .= $itemid;
}

print_r($result_itemid);

我尝试它并且它有效:输出

  

[0] => 7048668,[1] => 5651831等..

但我想要更多选项:

  

[0] [0] => 7048668 [0] [1] =>黑色    - [1] [0] => 5651831 [1] [1] =>白

谢谢:)

1 个答案:

答案 0 :(得分:0)

试试这个:

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteCond %{REQUEST_FILENAME} !-d
        RewriteCond %{REQUEST_FILENAME} !-s
    RewriteRule ^(.*)$ api.php?rquest=$1 [QSA,NC,L]

    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^(.*)$ api.php [QSA,NC,L]

    RewriteCond %{REQUEST_FILENAME} -s
    RewriteRule ^(.*)$ api.php [QSA,NC,L]   
</IfModule>