我var_dumped
一个变量并得到了这个,我怎样才能正确显示它?
像,
<p> Name: <?php echo $Firstname.' '.$Lastname; ?>
Country: <?php echo $country; ?></p>
<?php
array(3) {
[0]=> object(stdClass)#19 (3) {
["Firstname"]=> string(4) "John"
["Lastname"]=> string(4) "Lest"
["Country"]=> string(3) "USA"
}
[1]=> object(stdClass)#20 (3) {
["Firstname"]=> string(5) "Larry"
["Lastname"]=> string(4) "Jems"
["Country"]=> string(6) "Canada"
}
[2]=> object(stdClass)#21 (3) {
["Firstname"]=> string(3) "Jim"
["Lastname"]=> string(5) "Ricks"
["Country"]=> string(7) "England"
}
}
?>
答案 0 :(得分:0)
stdClass
是(某种)匿名对象。名字,姓氏和国家是属性。要访问它们:
echo $obj->Firstname