相关疑难解决方法(0)

XML分析错误 - 文档末尾的额外内容

我试图给出获得JSON或XML响应的选项.

JSON工作正常,但是当我查看XML时,我收到错误.

http://lmsapi.com/?api_key=fba9e59d7af86b239e82581780ff987e&format=json http://lmsapi.com/?api_key=fba9e59d7af86b239e82581780ff987e&format=xml

我不确定出了什么问题.我搜索过,我唯一看到的就是确保我没有任何额外的空格,甚至在我的元素名称中都有空格,我没有.

的index.php

<?php
require_once('includes/inc.settings.php');
if(${'Response'}['format'] == 'json'){
    print_r(${'Results'});  
}elseif(${'Response'}['format'] == 'xml'){
    header('Content-type: application/xml');
    echo "<?xml version=\"1.0\"?>";
    echo ${'Results'};
}
?>
Run Code Online (Sandbox Code Playgroud)

inc.settings.php

<?php
// ****************************************
// Require other includes 
// ****************************************
    require('Excel/PHPExcel.php');
    require('inc.variables.php');
    require('inc.functions.php');
    require('inc.browser.php');
    require('class.phpmailer.php');

// ****************************************
// Initial page setup
// ****************************************

    // Set our Error Handling
    if($debug == true){
        error_reporting(E_ALL);
        ini_set('display_errors', 1);
    } else {
        error_reporting(E_ERROR);
        ini_set('display_errors', 1);
    }

    // Set our timeout limit
    set_time_limit(30);

    // Set our memory limit
    ini_set('memory_limit', '128M');

    // Start …
Run Code Online (Sandbox Code Playgroud)

php xml

13
推荐指数
1
解决办法
8万
查看次数

标签 统计

php ×1

xml ×1