Xampp将图像文件保存到不会显示图像的测试数据库

时间:2018-04-25 02:52:00

标签: php html mysqli xampp

我已经在xampp上将两个图像插入到测试数据库中,我编写了几个用于显示图像的代码。但是我遇到了错误,我有屏幕截图:

我需要在div中显示一个img,点击后会显示该文件:

<?php
$server = "localhost";
$username = "daiori";
$password = "";
$db = "test";
$conn = mysqli_connect($server, $username, $password, $db);

$sql = "SELECT `pictures`, `filename` FROM `pictures`";
$run = mysqli_query($conn, $sql); 
$pictures = array($rows=>id, $rows=>filename,$rows=>pictures);

header("Content-Type: image/jpeg");
header("Content-Type: image/png");
header("Content-Type: image/gif");

function showFile(){
 $pictures;     
}

     $arrlength = count($pictures);
while($rows == true){
    for($i = 0; $i < $arrlength; $i++){
        base64_decode($pictures[$i], false);
    }
showFile(); 
}

?>

如果您查看屏幕截图,则会显示显示错误。你能解释一下显示错误的原因吗? enter image description here

0 个答案:

没有答案