douyulv6921 2011-11-30 20:55
浏览 40
已采纳

给定一个对象数组,如何回显内容?

I have an object array $this->result

When I echo $this->result I get Array.

When I print_r($this->result) I get a blank screen.

How do I find what is being stored in this object array?

EDIT: By blank screen I mean the nothing is being rendered at all.

EDIT2: Here is the code that renders, but I don't know what it's doing.

<?php  
    foreach ($this->result as $r){
        extract($r);
        // Then there is a bunch of code beneath here 
        // that displays different results
   } 
?>

However if I do this, the page no longer renders at all.

    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:

After installing and turning on xdebug, var_dump now displays the data. (however print_r() still does not). Any thoughts as to why that might be?

  • 写回答

2条回答 默认 最新

  • doudui1850 2011-11-30 21:42
    关注

    If available, honestly I would use a php debugger like xdebug and set up a debugging client and just inspect it. What is the reason for not knowing the contents of the objects in the array?

    print_r when set to true will return the output instead of printing it to the screen.

    what about

    foreach ($this->result as $r){
       print_r($r);
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 三相直流充电模块对数字电源芯片在物理上它必须具备哪些功能和性能?
  • ¥30 数字电源对DSP芯片的具体要求
  • ¥20 antv g6 折线边如何变为钝角
  • ¥30 如何在Matlab或Python中 设置饼图的高度
  • ¥15 nginx中的CORS策略应该如何配置
  • ¥30 信号与系统实验:采样定理分析
  • ¥100 我想找人帮我写Python 的股票分析代码,有意请加mathtao
  • ¥20 Vite 打包的 Vue3 组件库,图标无法显示
  • ¥15 php 同步电商平台多个店铺增量订单和订单状态
  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别