2

/*此代码在本地主机上工作(回显图像)但未显示在实时站点上*/请帮助,,,,

 <?php echo "<img src=geti/tipb_geti.php?id=$lastid  width=200px height=180px >";

/*下面这个php块是tipb_geti.php文件*/

 <?php
      include("connect.php");
      $id=@addslashes($_REQUEST['id']);

      $image_query=@mysql_query("select image from tipuranibasti where id=$id");
        $image_row=@mysql_fetch_assoc($image_query);


            $image=$image_row['image']; 
            header("content-type: image/jpeg");

          echo $image;              

?>    
4

2 回答 2

2

您的实时服务器的内存限制是多少?您在此处制作图像数据的两个副本:

$image=$image_row['image']; 

这是完全没有意义的。你可以简单地拥有

echo $image_row['image'];

而是为自己节省额外的浪费/无意义的复制操作。

于 2012-04-07T00:59:03.160 回答
-1

检查您的字符编码是否正确。liveb 可能有 UTF8 编码或服务器有,但你没有,如果没有,输出是什么?注释掉header("content-type: image/jpeg");并检查您是否在现场和本地获得相同的东西。

哦,我更喜欢:

<?php print'<img src="geti/tipb_geti.php?id=' . $lastid . '"  width="200px" height="180px" />';

使您的 html/xhtml 格式更好一些,并且print'test';print"test";“$var” 将输出 $var 的内容而 '$var' 不会输出稍微快一点,这会减少过热。但是不要认为你会从中获得超高速:P 你不会注意到更多的性能,我只是认为它提供了更好的代码。

于 2012-04-06T23:43:12.717 回答