我有一个对象数组$this->result
当我返回$this->result
时,我得到Array
。
当我print_r($this->result)
时,我得到一个黑屏。
如何找到这个对象数组中存储的内容?
编辑:我说的空白屏幕是指什么都没有呈现。
EDIT2:这是渲染的代码,但我不知道它在做什么。
<?php
foreach ($this->result as $r){
extract($r);
// Then there is a bunch of code beneath here
// that displays different results
}
?>
但是,如果我这样做,页面不再呈现。
echo '<pre>' . print_r($this->result, true) . '</pre>';
foreach ($this->result as $r){
extract($r);
// Then there is a bunch of code beneath here
// that displays different results
}
EDIT3:
安装并打开xdebug后,var_dump
现在显示数据。(然而print_r()
仍然没有)。有什么想法吗?
echo '<pre>' . print_r($this->result, true) . '</pre>';
更多阅读材料—参见"return"参数
如果有的话,老实说,我会使用像xdebug这样的php调试器,并设置一个调试客户端,然后检查它。不知道数组中对象的内容的原因是什么?
print_r设置为true时将返回输出,而不是将其打印到屏幕上。
foreach ($this->result as $r){
print_r($r);
}