PHP 中 XML 嵌入 base64 编码图像
我尝试使用 php 和 mySQL 将 BASE64 编码的图像嵌入到 XML 文件中,但没有成功。 图像作为 BLOB 字段存储在 mySQL 中。 以下是我正在开发的 php 脚本的一部分。 图像 blob 字段名为“filebin”。 我不断收到编码错误(即使我将字段设置为 CDATA)!
请帮忙!
$xml_output = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
$xml_output .= "<products>\n";
foreach($result as $row){
$xml_output .= "\t<item>\n";
$xml_output .= "\t\t<id>". $row['id'] . "</id>\n";
$xml_output .= "\t\t<filebin>".$row['filebin']."</filebin>\n";
}
I'm trying with no success to embed BASE64 encoded images in an XML file with php and mySQL.
The images are stored as BLOB fields in mySQL.
The following is a part of the php script I'm developing.
The image blob field is named "filebin".
I keep on getting encoding errors (even if I set the field as CDATA)!
Please help!
$xml_output = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
$xml_output .= "<products>\n";
foreach($result as $row){
$xml_output .= "\t<item>\n";
$xml_output .= "\t\t<id>". $row['id'] . "</id>\n";
$xml_output .= "\t\t<filebin>".$row['filebin']."</filebin>\n";
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 DOM 的示例
Example using DOM