这是可能的,并且它是使用PHP中的if语句中的heredoc进行编码的正确方法吗?是否有可能在if语句中使用heredoc?
if($selection!='')
{
$price=getselection($selection,$getprice[$selection]);
if ($selection<8)
{
print 'Please enter the amount<br />';
print '<form action="" method="post"><input type="text" name="money1" value="'.$money1.'">';
print '<input type="text" name="money2" value="'.$money2.'">';
print '<input type="text" name="money3" value="'.$money3.'"><input type="submit">';
print '<input type="hidden" name="selection" value="'.$selection.'"';
print '</form><br>';
if (($money1!='')&&($money2!='')&&($money3!==''))
{
$total=$money1+$money2+$money3;
$money=getmoney($total);
$change=getchange($total,$price);
}
}
}
echo '</pre>';
我试图避免失控的PHP代码,并跳进HTML,然后返回到PHP再次,我只是想保持对PHP脚本的一切;另外,使用多张打印纸很麻烦,谢谢你不要燃烧。
试试它而不是问这个问题会更容易吗? – 2009-11-21 05:34:12
@Ben Shelock:我真的不明白为什么人们不愿意尝试一些东西。如果尝试后它不起作用,那么你会问这个问题。 – MitMaro 2009-11-21 05:49:08