时间:2021-07-01 10:21:17 帮助过:3人阅读
下面列出完整代码
Bob's Auto Parts -Order Result
Bos's Auto Parts
Order Result
Order processed at".date('H:i, jS F Y')."";
echo " Your order is as follow:
";
echo $tireqty." tireqty
";
echo $oilqty." oilqty
";
echo $sparkqty." spark plugs
";
$totalqty = 0;
$totalqty = $tireqty + $oilqty + $sparkqty;
echo "Items ordered: ".$totalqty."
";
$totalamount = 0.00;
$totalamount = $tireqty * TIREPRICE +
$oilqty * OILPRICE + $sparkqty * SPARKPRICE;
echo "Subtotal: $".number_format($totalamount,2)."
";
$taxrate = 0.10; //total sales tax is 10%
$totalamount = $totalamount * (1 + $taxrate);
echo "Total including tax: $".number_format($totalamount,2)."
"
// echo "isset($tireqty)".isset($tireqty)."
";
// echo "isset($nothere)".isset($nothere)."
";
// echo "isset($tireqty)".empty($tireqty)."
";
// echo "isset($nothere)".empty($nothere)."
";
?>
添加如下几天语句页面变为空白,删除正常
echo "isset($tireqty)".isset($tireqty)."
";
echo "isset($nothere)".isset($nothere)."
";
echo "isset($tireqty)".empty($tireqty)."
";
echo "isset($nothere)".empty($nothere)."
";
下面列出完整代码
Bob's Auto Parts -Order Result
Bos's Auto Parts
Order Result
Order processed at".date('H:i, jS F Y')."";
echo " Your order is as follow:
";
echo $tireqty." tireqty
";
echo $oilqty." oilqty
";
echo $sparkqty." spark plugs
";
$totalqty = 0;
$totalqty = $tireqty + $oilqty + $sparkqty;
echo "Items ordered: ".$totalqty."
";
$totalamount = 0.00;
$totalamount = $tireqty * TIREPRICE +
$oilqty * OILPRICE + $sparkqty * SPARKPRICE;
echo "Subtotal: $".number_format($totalamount,2)."
";
$taxrate = 0.10; //total sales tax is 10%
$totalamount = $totalamount * (1 + $taxrate);
echo "Total including tax: $".number_format($totalamount,2)."
"
// echo "isset($tireqty)".isset($tireqty)."
";
// echo "isset($nothere)".isset($nothere)."
";
// echo "isset($tireqty)".empty($tireqty)."
";
// echo "isset($nothere)".empty($nothere)."
";
?>
前面的引号类的变量$nothere没有定义会报错,你没有开启debug模式就不会报错,也不会显示
isset和empty返回的都是bool类型,自然是不会显示的
echo "isset($tireqty)"...如果$tireqty没有定义会出错,因为这里双引号里面的isset是作为字符输出的
error_reporting(E_ALL);
ini_set("display_errors", 1);
添加到页面顶端