0

在尝试使用这种方式检索存储在数据库中的 blob 值时,我遇到了问题。请帮助我。

Blob 值以这种方式存储在数据库中。 数据库

 $criteria = [
            'lotItemNumber' => '',
            'artistName' =>$_POST['artistName'],
            'classification' =>$_POST['classification'],
            'producedYear' =>$_POST['producedYear'],
            'auctionDate' =>$_POST['auctionDate'],
            'textualDescription' =>$_POST['textualDescription'],
            'estimatedPrice' =>$_POST['estimatedPrice'],
            'image' =>'$temp'



              ];

$stmt = $stmt->insert($criteria);

并试图以这种方式检索: 我被卡住的地方

echo'<imgsrc="data:image/jpeg;base64,'.base64_encode($row['image']).'width="250" height="250">';

单击此图像图标产生 图片

实际图像是 实际图像是

4

1 回答 1

0
echo '<img src="data:image/jpeg;base64,'.base64_encode($row['image']).'" width="250" height="250">';
          ^ space here                                                 ^ close quote and add space

此外,应更改插入值:

$criteria = [
    //...
    'image' => $temp,  // do not use single quotes
];
于 2019-04-11T19:17:28.467 回答