Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php codeigniter RESTful API重新调整JSON语法错误_Php_Json_Codeigniter_Rest_Api - Fatal编程技术网

Php codeigniter RESTful API重新调整JSON语法错误

Php codeigniter RESTful API重新调整JSON语法错误,php,json,codeigniter,rest,api,Php,Json,Codeigniter,Rest,Api,Codeigniter的RESTful API的JSON响应在JSON前面插入HTML,导致JSON响应在我真正进入JSON之前就消失了。我用邮递员来测试,它给了我 SyntaxError: Unexpected token < in JSON 有没有人想过我如何摆脱这个HTML,使用这个PHP库只使用原始JSON??非常感谢尝试在methodUse ob_end_clean()中的响应后添加die()函数;responseThanks@user3774708 ob_end_clean(

Codeigniter的RESTful API的JSON响应在JSON前面插入HTML,导致JSON响应在我真正进入JSON之前就消失了。我用邮递员来测试,它给了我

SyntaxError: Unexpected token < in JSON

有没有人想过我如何摆脱这个HTML,使用这个PHP库只使用原始JSON??非常感谢

尝试在methodUse ob_end_clean()中的响应后添加die()函数;responseThanks@user3774708 ob_end_clean()之前;能够解决我的问题。这很有帮助!尝试在methodUse ob_end_clean()中的响应后添加die()函数;responseThanks@user3774708 ob_end_clean()之前;能够解决我的问题。这很有帮助!
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>

</body>
</html>

{"status":"success","message":[{"listitem_title":"Religion, Secularism, and Constitutional Democracy (Religion, Culture, and Public Life)","listitem_author":"","listitem_url":"https:\/\/stpsu.on.worldcat.org\/search?queryString=bn:9780231168717","listitem_img":"http:\/\/ecx.images-amazon.com\/images\/I\/41ed54Udo6L.jpg","listitem_id":"328","list_name":"New bookss Aug 29","page_list_id":"50","list_description":"New books for August 29","inst_id":"1"}..........
    function featuredslideshow_get(){
    //calls the featured slideshow data in JSON format
    $inst_id = $this->uri->segment(3);

    //locate featured pagelist ID
    $inst_data = $this->user_model->get_config($inst_id);

    //set pagelist ID
    $featured_id = $inst_data->featured_pagelist;

    //Find and search for featured items by pagelist ID
    $titles = $this->pagelist_model->pagelist_with_items($featured_id);

    if(isset($titles)){
        $this->response(array('status' => 'success', 'message'=> $titles));
    }else{
        $this->response(array('status' => 'failure', 'message' => 'The specified institution could not be found' ), REST_Controller::HTTP_NOT_FOUND);
    }
}//end of featured slideshow