【发布时间】:2012-01-03 17:02:28
【问题描述】:
我试图使用 codeigniter 创建一个 xml 响应。运行代码时会抛出以下错误。
此页面包含以下错误:
第 1 行第 48 列的错误:文档末尾的额外内容
<?php
class Api extends CI_Controller{
function index()
{
$this->load->helper('url', 'xml', 'security');
echo '<em>oops! no parameters selected.</em>';
}
function authorize($email = 'blank', $password = 'blank')
{
header ("content-type: text/xml");
echo '<?xml version="1.0" encoding="ISO-8859-1"?>';
echo '<node>';
if ($email == 'blank' AND $password == 'blank')
{
echo '<response>failed</response>';
}
else
{
$this->db->where('email_id', $email);
$this->db->limit(1);
$query = $this->db->from('lp_user_master');
$this->get();
$count = $this->db->count_all_results();
if ($count > 0)
{
foreach ($query->result() as $row){
echo '<ip>'.$row->title.'</ip>';
}
}
}
echo '</node>';
}
}
?>
【问题讨论】:
-
你能显示正在解析的最终结果吗?
标签: php xml codeigniter