无法在php、html中回显图像数据

无法在php、html中回显图像数据,php,html,Php,Html,我是php的noob,我不能用php显示图像数据。我试了1小时,但无法理解问题所在。请帮忙 <?php ini_set('mysql.connect_timeout',300); ini_set('default_socket_timeout',300); ?> 固定代码: <!DOCTYPE html> <html> <head> </head> <body> <form me

我是php的noob,我不能用php显示图像数据。我试了1小时,但无法理解问题所在。请帮忙

<?php
ini_set('mysql.connect_timeout',300);
ini_set('default_socket_timeout',300);
?>





固定代码:

<!DOCTYPE html>
<html>
    <head>
    </head>
<body>
    <form method="post" enctype="multipart/form-data">
        <input type="file" name="image">
        <input type="submit" name="submit" value="Upload">
    </form>
    <?php
        if(isset($_POST['submit'])) {
            $imagedata=file_get_contents($_FILES["image"]["tmp_name"]);
            echo $imagedata;
        } else {
            echo "there has been some error";
        }
    ?>
</body>
</html>


然而,这只会输出二进制数据。如果您想实际显示图像,您需要做更多的工作…

请注意,这里有很多错误。已在PHP7中删除。了解和的语句,并考虑使用PDO。非常感谢。从现在起,我将在项目中使用mysqli。我不知道pdo是什么,但我会用谷歌搜索它。谢谢again@JohnConde是的,我已经认出了他们。谢谢:)谢谢你,程序员同事:)
<!DOCTYPE html>
<html>
    <head>
    </head>
<body>
    <form method="post" enctype="multipart/form-data">
        <input type="file" name="image">
        <input type="submit" name="submit" value="Upload">
    </form>
    <?php
        if(isset($_POST['submit'])) {
            $imagedata=file_get_contents($_FILES["image"]["tmp_name"]);
            echo $imagedata;
        } else {
            echo "there has been some error";
        }
    ?>
</body>
</html>