下面这个html字符串,如何用php的echo或print来输出?
<td width=275><input type="text" name="title" value="<?php echo $row['title']; ?>"></td>
echo "<td width=275><input type="text" name="title" value="<?php echo $row['title']; ?>"></td>"
不可以
echo '<td width=275><input type="text" name="title" value="<?php echo $row['title']; ?>"></td>'
也不可以
print <<<EOT
<td width=275><input type="text" name="title" value="<?php echo $row['title']; ?>"></td>
EOT;
也不可以,应为,这段html还包含php语句。
我的真实需求是
<?php
if(isset($_POST['flag'])
{
print <<<EOT
<td width=275><input type="text" name="title" value="<?php echo $row['title']; ?>"></td>
EOT;
else
{
}
?>
3 回答
![?](http://img1.sycdn.imooc.com/54584d6100015f5802200220-100-100.jpg)
明月笑刀无情
TA贡献1828条经验 获得超4个赞
//方法1
echo '<td width=275><input type="text" name="title" value="'.$row['title'].'"></td>';
//方法1变形体
$a = '<td width=275><input type="text" name="title" value="';
$a .= $row['title'];
$a .= '"></td>';
echo $a;
//方法2
echo
<<<EOT
<td width=275><input type="text" name="title" value="{$row['title']}"></td>
EOT;
- 3 回答
- 0 关注
- 779 浏览
添加回答
举报
0/150
提交
取消