-4

可能重复:
MySql、PHP 在 HTml 上显示图片

如何在我的 php 表中显示图片“在我的 ocde 的屏幕截图部分”?当我在我的网站上显示表格时,我不想像我的代码现在所做的那样从图片中看到名称,但我想看到真实的图片:

此代码将从 sql 数据库中获取所有信息。

我的代码

echo "<table class=showtable>";
echo "<tr>
<td class=show >".$row['ID']."</td>
<td class=show2>".$row['DateTime']."</td>
<td class=show3>".$row['Stock']."</td>
<td class=show4>".$row['Type']."</td>
<td class=show5>".$row['Trade']."</td>
<td class=show5>".$row['Entry']."</td>
<td class=show5>".$row['Stoploss']."</td>
<td class=show5>".$row['Target1']."</td>
<td class=show5>".$row['Target2']."</td>
<td class=show6>".$row['Explination']."</td>
<td class=show7>".$row['Screenshot']."</td> </tr>";
 echo "</table>";
  }
4

3 回答 3

0

是的,上面的答案是正确的,只需在图像标记 src 属性中使用图像标记和过去的图像路径。然后图像将使用您的 php 路径显示。

http://www.webmasterworld.com/forum88/10480.htm

于 2012-10-26T08:16:02.827 回答
0

您应该使用带有连接“.jpg”或“.png”的图像文件扩展名

于 2012-10-26T08:23:09.013 回答
0

只需添加 1 个带有 src 您的 img 名称的 img 标签。

echo "<table class=showtable>";
echo "<tr>
<td class=show >".$row['ID']."</td>
<td class=show2>".$row['DateTime']."</td>
<td class=show3>".$row['Stock']."</td>
<td class=show4>".$row['Type']."</td>
<td class=show5>".$row['Trade']."</td>
<td class=show5>".$row['Entry']."</td>
<td class=show5>".$row['Stoploss']."</td>
<td class=show5>".$row['Target1']."</td>
<td class=show5>".$row['Target2']."</td>
<td class=show6>".$row['Explination']."</td>
<td class=show7><img src='".$row['Screenshot']."' /></td> </tr>";
 echo "</table>";
  }

如果该图像在文件夹中,您必须写入文件夹
<img src='/img/".$row['Screenshot']."' />

于 2012-10-26T08:05:28.970 回答