我从查询中获取ParseObject,我需要将其转换为json。
当我执行print_r($ results)时,我得到了很多东西但是当我执行$ json = json_encode($ results)并打印它时,$ json为空。
这是$ results的var_dump:
array (size=5)
0 =>
object(Parse\ParseObject)[12]
protected 'serverData' =>
array (size=1)
'Usuario_FK' =>
object(Parse\ParseUser)[15]
...
protected 'operationSet' =>
array (size=0)
empty
private 'estimatedData' =>
array (size=1)
'Usuario_FK' =>
object(Parse\ParseUser)[15]
...
private 'dataAvailability' =>
array (size=1)
'Usuario_FK' => boolean true
private 'className' => string 'Asistencia' (length=10)
private 'objectId' => string 'mdHR3ZZo6z' (length=10)
private 'createdAt' =>
object(DateTime)[13]
public 'date' => string '2015-06-10 01:17:13' (length=19)
public 'timezone_type' => int 2
public 'timezone' => string 'Z' (length=1)
private 'updatedAt' =>
object(DateTime)[14]
public 'date' => string '2015-06-13 13:34:05' (length=19)
public 'timezone_type' => int 2
public 'timezone' => string 'Z' (length=1)
private 'hasBeenFetched' => boolean false
1 =>
object(Parse\ParseObject)[21]
protected 'serverData' =>
array (size=1)
'Usuario_FK' =>
object(Parse\ParseUser)[24]
...
protected 'operationSet' =>
array (size=0)
empty
private 'estimatedData' =>
array (size=1)
'Usuario_FK' =>
object(Parse\ParseUser)[24]
...
private 'dataAvailability' =>
array (size=1)
'Usuario_FK' => boolean true
private 'className' => string 'Asistencia' (length=10)
private 'objectId' => string '3DK19BWOYY' (length=10)
private 'createdAt' =>
object(DateTime)[22]
public 'date' => string '2015-06-10 01:08:14' (length=19)
public 'timezone_type' => int 2
public 'timezone' => string 'Z' (length=1)
private 'updatedAt' =>
object(DateTime)[23]
public 'date' => string '2015-06-13 13:34:09' (length=19)
public 'timezone_type' => int 2
public 'timezone' => string 'Z' (length=1)
private 'hasBeenFetched' => boolean false
2 =>
object(Parse\ParseObject)[30]
protected 'serverData' =>
array (size=1)
'Usuario_FK' =>
object(Parse\ParseUser)[33]
...
protected 'operationSet' =>
array (size=0)
empty
private 'estimatedData' =>
array (size=1)
'Usuario_FK' =>
object(Parse\ParseUser)[33]
...
private 'dataAvailability' =>
array (size=1)
'Usuario_FK' => boolean true
private 'className' => string 'Asistencia' (length=10)
private 'objectId' => string 'x94VIvFpdq' (length=10)
private 'createdAt' =>
object(DateTime)[31]
public 'date' => string '2015-06-10 01:07:38' (length=19)
public 'timezone_type' => int 2
public 'timezone' => string 'Z' (length=1)
private 'updatedAt' =>
object(DateTime)[32]
public 'date' => string '2015-06-13 13:34:11' (length=19)
public 'timezone_type' => int 2
public 'timezone' => string 'Z' (length=1)
private 'hasBeenFetched' => boolean false
3 =>
object(Parse\ParseObject)[39]
protected 'serverData' =>
array (size=1)
'Usuario_FK' =>
object(Parse\ParseUser)[42]
...
protected 'operationSet' =>
array (size=0)
empty
private 'estimatedData' =>
array (size=1)
'Usuario_FK' =>
object(Parse\ParseUser)[42]
...
private 'dataAvailability' =>
array (size=1)
'Usuario_FK' => boolean true
private 'className' => string 'Asistencia' (length=10)
private 'objectId' => string 'z4vtVb9sdU' (length=10)
private 'createdAt' =>
object(DateTime)[40]
public 'date' => string '2015-06-10 01:13:05' (length=19)
public 'timezone_type' => int 2
public 'timezone' => string 'Z' (length=1)
private 'updatedAt' =>
object(DateTime)[41]
public 'date' => string '2015-06-13 13:34:07' (length=19)
public 'timezone_type' => int 2
public 'timezone' => string 'Z' (length=1)
private 'hasBeenFetched' => boolean false
4 =>
object(Parse\ParseObject)[48]
protected 'serverData' =>
array (size=1)
'Usuario_FK' =>
object(Parse\ParseUser)[51]
...
protected 'operationSet' =>
array (size=0)
empty
private 'estimatedData' =>
array (size=1)
'Usuario_FK' =>
object(Parse\ParseUser)[51]
...
private 'dataAvailability' =>
array (size=1)
'Usuario_FK' => boolean true
private 'className' => string 'Asistencia' (length=10)
private 'objectId' => string 'LRsOGB7mjZ' (length=10)
private 'createdAt' =>
object(DateTime)[49]
public 'date' => string '2015-06-10 03:13:36' (length=19)
public 'timezone_type' => int 2
public 'timezone' => string 'Z' (length=1)
private 'updatedAt' =>
object(DateTime)[50]
public 'date' => string '2015-06-13 14:01:03' (length=19)
public 'timezone_type' => int 2
public 'timezone' => string 'Z' (length=1)
private 'hasBeenFetched' => boolean false
这是在json_encode($ results);
之后[{},{},{},{},{}]
想法?
感谢您的时间!