douhe2305 2015-11-12 15:26
浏览 58
已采纳

PHP json_encode不编码...为什么?

I've the following array in a $arrayResult:

array (size=1)
  'Records' => 
    array (size=1498)
      0 => 
        array (size=4)
          'code' => string '9999999' (length=12)
          'nome' => string 'XXXXXXXXX' (length=39)
          'contrato' => string '67971' (length=5)
          'status' => string 'A' (length=1)
      1 => 
        array (size=4)
          'code' => string '777777777' (length=12)
          'nome' => string 'WWwwwwwww' (length=40)
          'contrato' => string '67725' (length=5)
          'status' => string 'C' (length=1)

    .... (other results with the same pattern)

    $resultArray = $view->getAllAccounts();
    $final['Records'] = $resultArray;
    echo json_encode($final, true);

when I get the array and use the json_encode nothing happens.

  • 写回答

1条回答 默认 最新

  • douniao7308 2015-11-12 15:31
    关注

    Regardless of the data-structures and code you wrote so far, if you encounter unexpected behaviour using json_decode and json_encode, use json_last_error and/or json_last_error_msg to see what happened.

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

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?