0
我得到這個對象:訪問屬性
SimpleXMLElement Object\n(\n
[@attributes] => Array\n (\n
[article_number] => 550007\n )\n\n
[serial_number] => Array\n (\n
[0] => 5500070000126237\n
[1] => 5500070000126246\n
[2] => 5500070000126255\n
[3] => 5500070000126264\n
[4] => 5500070000126273\n )\n\n)\n
我要訪問這樣的屬性,但它似乎並沒有工作:
foreach ($product_array as $codes)
{
error_log($codes->product[0]->attributes()->article_number);
}
侏儒我固定這種方式:'\t \t \t \t \t \t的foreach($ codes->屬性()作爲$ article_number){ \t \t \t \t \t \t \t error_log中($ article_number); \t \t \t \t \t \t \t // error_log($ codes-> serial_number); \t \t \t \t \t \t} '會接受你的答案認爲 –
爲什麼downvote? – Znarkus
+1 Znarkus,只有答案我可以足夠驚奇地發現這個問題。 – Shane