如何在 php 代码中获取值字段 [ID] stdClass 对象

how get value feild[ID] stdClass Object in php code

如何在 php 代码

中获取值 feild[id]
stdClass Object ( [List_inserted] => Array ( [0] => stdClass Object ( [ID] => 145001 [value] => 40 ) ) [Sucssess] => 1 [ErrorMassage] => OK ) 

你没有给我们一个名字 stdClass 所以我假设它是 $stdClass.

$stdClass->List_inserted[0]->ID

让我们分解一下;

stdClass Object ( [List_inserted] => Array ( [0] => stdClass Object ( [ID] => 145001 [value] => 40 ) ) [Sucssess] => 1 [ErrorMassage] => OK )

我们使用 -> 访问对象,我们使用 []
访问数组 第一部分告诉我们它是一个对象,所以它是;

$stdClass->List_inserted

由于 => Array

List_inserted 是一个数组。我们可以通过 [0].

访问它

$stdClass->List_inserted[0]

嗯,List_inserted[0]是一个对象,太感谢了[0] => stdClass Object;并且您想访问该 ID?所以我们需要另一个 ->

$stdClass->List_inserted[0]->ID