为了账号安全,请及时绑定邮箱和手机立即绑定

如何用数据库表的下一个 blob 条目替换 blob 中的单词

如何用数据库表的下一个 blob 条目替换 blob 中的单词

PHP
慕娘9325324 2021-07-08 14:01:32
我正在尝试构建一个页面,该页面能够读取表格并写下所选条目(时间、发件人、收件人、标题和内容),该页面工作正常。我面临的问题是第一个内容条目是这样的文本 BLOBex.TextTextTextTextTextText TextTextTextTextimg1.jpgTextTextTextTextTextTextTextTextTextTextText将img1.jpg被保存在接下来的内容条目保存在BLOB,且必须编码要打印的图像Base64和现在,而试图把它写下来这样我被堵TextTextTextTextTextTextTextTextTextText(actual image from the next entry)TextTextTextTextTextTextTextTextTextTextText我试图检查strpos内容是否包含下一个 blob 的文件名,然后用实际图像替换它,但我无法在同一行中获取下一个表条目这是正常输出的代码$res = mysqli_query($link, createRequest(true, $link)) or die(mysqli_error($link));while($row = mysqli_fetch_assoc($res)){    $title = $row["a_subject"];    $time = $row["create_time"];    $sender = $row["a_from"];    $reciever = $row["a_to"];    $body = $row["content"];    $articleid = $row["id"];    if (strpos($body, '')){        $img = "<pre>".'<img src="data:image/jpeg;base64,'.base64_encode( $body).'"/>'."</pre>"    ?>    <tr>    <td><?php echo ($time) ?></td>    <td><?php echo ($sender) ?></td>    <td><?php echo ($reciever) ?></td>    <td><?php echo ($title) ?></td>    <td><?php echo $img ?></td>    <td><a href=<?php echo "http://localhost/php/imageviewer.php?ArticleID=".$row["id"].""?>>Zeige Anhänge</a></td>    </tr>    <?php    } else {        ?>    <tr>    <td><?php echo ($time) ?></td>    <td><?php echo ($sender) ?></td>    <td><?php echo ($reciever) ?></td>    <td><?php echo ($title) ?></td>    <td><?php echo utf8_encode($body)?></td>    <td><a href=<?php echo "http://localhost/php/imageviewer.php?ArticleID=".$row["id"].""?>>Zeige Anhänge</a></td>    </tr>    <?php现在我正在检查内容是图像还是只是一些文本,然后将它们写下来。我想要发生的是,让我们说文本内容是:textimg1textimg2textimg3 我当前的解决方案我得到了 4 个 html 表条目,第一个是textimg1.jpgtextimg2.jpgtextimg3 .jpg第二个是actual image of img1.jpg第三个是actual image of img2.jpg等等我最终想要的是一个看起来像这样的表条目textactual img1textactual img2textactual img3
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 196 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信