codeigniter- 在用户选择中显示图像
codeigniter- display image in user pick
我是 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 ;
尝试这样的事情:
$userItem = $_GET['item'];
echo "You Picked: <img src ='http://localhost/image/" . $userItem . ".png'/>";
我是 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 ;
尝试这样的事情:
$userItem = $_GET['item'];
echo "You Picked: <img src ='http://localhost/image/" . $userItem . ".png'/>";