當(dāng)我 curl 請(qǐng)求給對(duì)方時(shí)
$data = array(
"a" => $a,
"b" => $b
);
$data_string = json_encode($data);
假設(shè)我這邊給對(duì)方的 b 沒(méi)有值對(duì)方那邊收到會(huì)是null那是否可以變成當(dāng)我這邊沒(méi)有值的時(shí)候我可否主動(dòng)給對(duì)方 undefined 而不是 null?
對(duì)方是這樣設(shè)定的:
2 回答

慕娘9325324
TA貢獻(xiàn)1783條經(jīng)驗(yàn) 獲得超4個(gè)贊
$data = array(
"a" => $a,
);
if($b)
{
$data['b'] = $b;
}
- 2 回答
- 0 關(guān)注
- 331 瀏覽
添加回答
舉報(bào)
0/150
提交
取消