使用空格访问类属性
2022-08-30 10:26:27
stdClass Object ([Sector] => Manufacturing [Date Found] => 2010-05-03 08:15:19)
所以我可以通过使用访问,但我如何访问?[Sector]
$object->Sector
[Date Found]
stdClass Object ([Sector] => Manufacturing [Date Found] => 2010-05-03 08:15:19)
所以我可以通过使用访问,但我如何访问?[Sector]
$object->Sector
[Date Found]
你可以这样做:
$object->{'Date Found'}
你试过吗
$property = 'Date Found';
$object->{$property};
或者干脆
$object->{'Date Found'};