我有以下数组...从此代码生成。
$aa = new_Arr();
print_r($aa); //here is the result...
cl_aa Object
(
[data:cl_aa:private] => Array
(
[t_a] => Array
(
[0] => Array
(
[f_c] => LAL
[p_r] => RN
[id] => 1214125
[gender] => m
)
)
[t_b] => Array
(
)
[t_l] => Array
(
[0] => Array
(
[p_lev] => 2
[p_date] =>
[p_r] =>
)
)
[t_r] => Array
(
[0] => Array
(
[I_r] => 19
)
)
)
[db:cl_aa:private] => PDOTester Object
(
)
)
我试着像这样阅读......
foreach ($aa as $key=>$value) {
print_r($key);
echo "<h1>". $value['bb']. "</h1>";
}
但没有结果我可以看到...
我如何阅读上面的数组?请帮忙吗?
答案 0 :(得分:1)
为您的cl_aa
课程提供一些获取者:
public class cl_aa {
private $data;
private $db;
public function getData() {
return $this->data;
}
public function getDb() {
return $this->db;
}
}
并从外部访问您的数据:
$aa = new_Arr(); // I assume this function returns a cl_aa object.
print_r($aa->getData());
print_r($aa->getDb());
请查看this link以了解有关OOP的更多信息。