【发布时间】:2020-04-16 04:47:43
【问题描述】:
我从网络服务中得到了这个,并尝试了很多我在类似主题中找到的解决方案,但无法将它们分开以在我的代码中使用:
stdClass Object (
[getPropsListResult] => [
{
"id":16461,
"Material":"1000001",
"SalesDescription":"product1",
"Plnt":"1339",
"PlantName":"WAREHOUSE1",
"SalesPrice":"15000"
},
{
"id":16462,
"Material":"1000001",
"SalesDescription":" product2",
"Plnt":"1018",
"PlantName":"WAREHOUSE2",
"SalesPrice":"15000"
},
{
"id":16463,
"Material":"1000002",
"SalesDescription":" product3",
"Plnt":"1339",
"PlantName":"WAREHOUSE1",
"SalesPrice":"22000"
},
{
"id":32920,
"Material":"1072941",
"SalesDescription":"product4",
"Plnt":"1018",
"PlantName":" WAREHOUSE1",
"SalesPrice":"0"
}
]
)
请帮助我如何使用这些信息?
【问题讨论】:
-
你不能
separate他们是什么意思? -
我需要知道每个产品的 id、名称和 salesprice 以插入到我的数据库中。
-
您可以将 Web 服务响应分配给一个变量。让我们称之为
$result。然后你可以在$result->getPropsListResult数组上做一个循环