1 回答

TA貢獻(xiàn)2012條經(jīng)驗(yàn) 獲得超12個(gè)贊
看起來你的結(jié)構(gòu)應(yīng)該是
? while ( $row = $result->fetch_assoc())? {
? ? $rowarray['id'] = $row['ContractID'];
? ? $rowarray['recipientOrganization'] = array(
? ? ? ? ?"id" => $row['id'],
? ? ? ? ?"companyNumber" => $row['companyNumber'],
? ? ? ? ?"charityNumber" => $row['charityNumber'],
? ? ? ? ?"name" => $row['name']
? ? );
? ? $rowarray['fundingOrganization'] = array(
? ? ? ? ?"id" => $row['id'],
? ? ? ? ?"name" => $row['name']
? ? );
? ? $rowarray['title'] = $row['Service_Name'];
? ? $rowarray['currency'] = 'GBP';
? ? //$rowarray['amountAppliedFor'] = $row['Sum_Requested'];
? ? $rowarray['amountAwarded'] = $row['Sum_Approved'];
? ? //$rowarray['awardDate'] = $row['Decision_Date'];
? ? $dbdata['grants'][] = $rowarray;
? }
我喜歡做的另一個(gè)技巧是將 json 放入 phpsandbox 并將其轉(zhuǎn)換為數(shù)組以查看結(jié)構(gòu)。
- 1 回答
- 0 關(guān)注
- 169 瀏覽
添加回答
舉報(bào)