我正在使用以下代码发送 json 格式作为输入并将其存储在 db 中。当我解码该值时,什么都没有。我的代码出了什么问题。有人能帮助我吗。
控制器
function join_community_post(){
$serviceName = 'join_community';
//getting posted values
$c = '{"community" : [{"community_id":1},{"community_id":2},{"community_id":3}]}';
$ip = trim($this->input->post($c));
$ipJson = json_decode($ip);
print_r ($ipJson);exit;
$retVals = $this->user_model->user_join_community($ip, $serviceName);
header("content-type: application/json");
echo $retVals;
exit;
}
模型
function user_join_community($ip,$serviceName) {
$ipJson = json_decode($ip);
}