【问题标题】:how get value feild[ID] stdClass Object in php code如何在 php 代码中获取值字段 [ID] stdClass 对象
【发布时间】:2018-04-03 20:17:50
【问题描述】:

如何在 php 代码中获取值 feild[id]

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

【问题讨论】:

  • 你付出了哪些努力?你能告诉我们你的努力没有奏效吗?因为它的 $obj->List_inserted[0]->ID

标签: php stdclass


【解决方案1】:

你没有给我们一个名字 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

List_inserted 是一个数组,这要归功于=> Array。我们可以使用 [0] 访问它。

$stdClass->List_inserted[0]

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

$stdClass->List_inserted[0]->ID

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多