arrays - How to get this type of json with php? -
I need to get a JSON such as [8,3,4,5,6,7,15] Is . I'm trying to get it done on the basis of the past 30 days.
$ a = array (); ($ I = 0; $ i & lt; 30; $ i ++) for {$ tmp_array = array (); $ InicioDia = date ('Y-M-D 00:00:00', Stratetime ('today -'. $ I. 'Day')); $ Fimia = Date ('Y-M-D23:59:59', Stratetime ('Today -'. $ I. 'Day')); $ NumeroSolicitacao = $ this- & gt; Solit-- gt; Find ('calculation', array ('conditions' = & gt; array ('data & gt;' = & gt; $ inicioDia, 'data & lt;' = = gt; $ fimDia))); // query array_push ($ tmp_array, $ numeroSolicitacao); $ a = $ tmp_ user; } Json_encode ($ a) This is coming back with "all", which I do not know, and only ["all", 3] Number one . How do I get an array like this?
Do you know that you mix the array?
Try it
& lt ;? php $ tmp_array = array (); ($ I = 0; $ i & lt; 30; $ i ++) for {$ inicioDia = date ('Ymd 00:00:00', stratetime ('today -'. $ I. 'days')) ; $ Fimia = Date ('Y-M-D23:59:59', Stratetime ('Today -'. $ I. 'Day')); $ NumeroSolicitacao = $ this- & gt; Solit-- gt; Find ('calculation', array ('conditions' = & gt; array ('data & gt;' = & gt; $ inicioDia, 'data & lt;' = = gt; $ fimDia))); // query array_push ($ tmp_array, $ numeroSolicitacao); } Json_encode (tmp_array);
Comments
Post a Comment