donglianglu8136 2013-09-03 12:03
浏览 22
已采纳

在Zend框架2中显示为JSON中的网格

I am new in zf2. I have to display list of data from database and add, edit, delete operations using JSON. I am using this code to convert the data into JSON.

public function getList()
    {
    $results = $this->getAlbumTable()->fetchAll();
    $data = array();
    foreach($results as $result) {
        $data[] = $result;
    }

    return new JsonModel(array(
        'data' => $data,
    ));
} 

But I don't know how to display data from this JSON. I searched and didn't get any correct codes. Please help me.

  • 写回答

1条回答 默认 最新

  • dongtan1845 2013-09-04 09:11
    关注

    You can simply decode the json and use the array in your view, I am not very clear about the scope of your question but from my understanding this is your model function which returns the data in json format, than you can decode the json and pass it to your view.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 C#不用正则表达式如何全字匹配
  • ¥15 怎么生成确定数目的泊松点过程
  • ¥15 python点云生成mesh精度不够怎么办
  • ¥15 QT C++ 鼠标键盘通信
  • ¥15 改进Yolov8时添加的注意力模块在task.py里检测不到
  • ¥50 高维数据处理方法求指导
  • ¥100 数字取证课程 关于FAT文件系统的操作
  • ¥15 如何使用js实现打印时每页设置统一的标题
  • ¥15 安装TIA PortalV15.1报错
  • ¥15 能把水桶搬到饮水机的机械设计