我有下一个代码,它不打印 var 的值$item。我如何让它返回项目的值。<?php$item = "wewewe";$plu = $_POST[‘plu’];$img = $_POST[‘img’];$password = $_POST[‘password’];echo '<tr> <td><input type="checkbox"></td> <td>'.$item.' </td> <td>666</td> <td> <img src="apple.jpg" alt=""> </td></tr>' ?>
2 回答

忽然笑
TA贡献1806条经验 获得超5个赞
试试这个:
<?php
$item = "wewewe";
$plu = (isset($_POST['plu']))?$_POST['plu']:'';
$img = (isset($_POST['img']))?$_POST['img']:'';
$password = (isset($_POST['password']))?$_POST['password']:'';
?>
<tr>
<td><input type="checkbox"></td>
<td><?= $item ?></td>
<td>666</td>
<td> <img src="apple.jpg" alt=""> </td>
</tr>
希望能帮助到你。

一只斗牛犬
TA贡献1784条经验 获得超2个赞
在 php 中,如果你想打印一个值或一个变量,你必须使用“echo”关键字。
试试这个 :
<?php echo '
<tr>
<td><input type="checkbox"></td>
<td> '.$item.' </td>
<td>666</td>
<td> <img src="apple.jpg" alt=""> </td>
</tr>'; ?>
- 2 回答
- 0 关注
- 190 浏览
添加回答
举报
0/150
提交
取消