stdClass Object
(
[request] => stdClass Object
(
[other] => stdClass Object
(
[4] => stdClass Object
(
[answer] => one
)
[5] => stdClass Object
(
[answer] => two
)
[6] => stdClass Object
(
[answer] => three
)
)
)
)
?>
我可以通过使用 foreach 循环打印出所有答案。
foreach( $result->request->other as $test )
$tests[] = $test->answer;
foreach($tests as $test1){
echo "<p>$test1</p><br>";
}
我对如何回显答案编号有点困惑,在这种情况下是 4 5 6。我如何将它们作为循环的一部分回显。前任:
4 one
5 two
6 three