我已经完成了以下代码以从URL中提取图像,但是我收到了XML解析错误。如何显示包含所有XML输出的图像?用XML输出显示图像
$error = true;
$msg = 'profile';
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
if($error)
{
echo "<response>";
echo "<success>S</success>";
echo "<message>".trim($msg)."</message>";
echo "<userid>".trim($userid)."</userid>";
echo "<username>".trim($username)."</username>";
echo "<firstname>".trim($firstname)."</firstname>";
echo "<lastname>".trim($lastname)."</lastname>";
echo "<email>".trim($email)."</email>";
echo "<follower>".trim($follower)."</follower>";
//echo "<photo><img src=photo/".trim($photo) ." height='200' width='200'></photo>";
echo "</response>";
}
避免形成个XML这样的。改用API/LIB。 – SparKot 2013-02-12 11:34:51
我不认为你可以添加一个图像到XML输出,你仍然可以提供它的URL,并以其他方式呈现。 – Gntem 2013-02-12 11:35:49
XML中的属性必须包含在''''或''''中。 – SparKot 2013-02-12 11:36:13