我如何在下面将其转换为JSON?

时间:2018-12-05 04:32:39

标签: json codeigniter-3

这是我的代码

$location=$this->input->post('location');
        $this->db->select('*');
        $this->db->from('ad');
        $query=$this->db->get();
        $result1=$query->result();
        foreach($result1 as $ke){
            $data=explode(',',$ke->place);
            foreach($data as $key){
                if($key==$location){
                    $id= $ke->id;
                    $query=$this->db->get_where('ad',array('id'=>$id));
                    $result=$query->result();
                    echo json_encode($result);

                    }
            }
        }

我正在使用邮递员检查代码。在邮递员中,当选择json时,其结果语法错误,但html结果没有问题

0 个答案:

没有答案
相关问题