我是codeigniter的新手。我想在用户选择时显示图像。但我的结果是文字而不是图像。有人可以帮帮我吗?
视图:
<table>
<tr>
<td style=border:hidden><a href="?item=apple"><br /><img src ="http://localhost/image/apple.png" alt="apple" width="100px" height="50px"></a></td>
<td style=border:hidden><a href="?item=orange"><br /><img src ="http://localhost/image/orange.png" alt="orange" width="100px" height="50px" style="margin-top:10px"></a></td>
<td style=border:hidden><a href="?item=grape"><br /><img src ="http://localhost/image/grape.png" alt="grape" width="100px" height="50px" style="margin-top:10px"></a></td>
</tr>
</table>
控制器:
$userItem = $_GET['item'];
echo "You Picked:" $userItem ;
答案 0 :(得分:1)
尝试这样的事情:
$userItem = $_GET['item'];
echo "You Picked: <img src ='http://localhost/image/" . $userItem . ".png'/>";