gpt4 book ai didi

php - 在 xml 中回显 blob

转载 作者:行者123 更新时间:2023-11-30 01:32:30 24 4
gpt4 key购买 nike

我试图以 xml 形式将 MySQL 中存储的 Base64 图像(blob)显示为 base64 字符串。但我收到此错误:

Below is a rendering of the page up to the first error.

这是我的代码

if($_GET['id'] != '') {

$sql = 'SELECT * FROM CDUsers WHERE id =  '.$_GET['id']; } else {   $sql = 'SELECT * FROM CDUsers'; }
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_num_rows($result);
header('Content-type: text/xml');
if($row != 0) {?>
<CDUsers><?php while($user = mysql_fetch_assoc($result))
{ ?>
<user>
<user_foto><?php echo($user['foto']);?></user_foto>

</user><?php
} ?> </CDUsers><?php
} else {
?> <CDUsers>
<user>vazio</user>
</CDUsers><?php

} ?>

最佳答案

blob 不是以 base64 存储的。

这只是 phpMyAdmin 对二进制文件的演示。

<?php echo(base64_encode($user['foto'])); ?>

关于php - 在 xml 中回显 blob,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17299913/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com