我有这个扣子:
foreach($jsonU as $j) {
$jsonUId = $j->id;
$jsonUName = $j->name;
$jsonUDescription = $j->description;
$jsonUDate = $j->date;
$jsonUStatus = $j->status;
$jsonUPicture = $j->picture;
$jsonUncompleted[] = array('id'=> $jsonUId, 'name'=> $jsonUName, 'description' => $jsonUDescription, 'date' => $jsonUDate, 'status' => $jsonUStatus, 'picture' =>$jsonUPicture);
}
只有当有值时,我才需要在数组中插入一个键。例如,$jsonUPictore
并不总是有一个值,在这种情况下我不需要写那个键。
一些帮助?