Guest User

Untitled

a guest
Feb 20th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. array(2) {
  2. [0]=>
  3. object(PackingListData)#6 (8) {
  4. ["referencia"]=>
  5. string(10) "27713/5294"
  6. ["estilo"]=>
  7. string(5) "14376"
  8. ["bultos"]=>
  9. string(2) "26"
  10. ["total_bultos"]=>
  11. string(2) "28"
  12. ["piezas_teoricas"]=>
  13. string(2) "27"
  14. ["total_piezas"]=>
  15. string(2) "28"
  16. ["pack_id"]=>
  17. string(1) "5"
  18. ["id"]=>
  19. string(2) "10"
  20. }
  21. [1]=>
  22. object(PackingListData)#7 (8) {
  23. ["referencia"]=>
  24. string(10) "27713/5294"
  25. ["estilo"]=>
  26. string(5) "14377"
  27. ["bultos"]=>
  28. string(1) "2"
  29. ["total_bultos"]=>
  30. string(2) "28"
  31. ["piezas_teoricas"]=>
  32. string(1) "3"
  33. ["total_piezas"]=>
  34. string(1) "4"
  35. ["pack_id"]=>
  36. string(1) "5"
  37. ["id"]=>
  38. string(2) "11"
  39. }
  40. }
  41.  
  42. <?php
  43.  
  44. header('Content-type:application/json;charset=utf-8');
  45.  
  46. $id = 5;
  47.  
  48. $packing = PackingListData::getPackingList($id);
  49.  
  50. $arr = array();
  51.  
  52. foreach ($packing as $pack) {
  53.  
  54. $arr = array( 'id'=>$pack->id,
  55. 'referencia' =>$pack->referencia,
  56. 'estilo'=>$pack->estilo,
  57. 'bultos'=>$pack->bultos,
  58.  
  59. );
  60. echo json_encode($arr);
  61. }
  62.  
  63. {"id":"10","referencia":"27713/5294","estilo":"14376","bultos":"26"}{"id":"11","referencia":"27713/5294","estilo":"14377","bultos":"2"}
Add Comment
Please, Sign In to add comment