欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

html5 - php中添加了如下语句出现空白页 删除页面zhengchang

程序员文章站 2022-06-11 14:04:00
...
添加如下几天语句页面变为空白,删除正常
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)."
";

            ?>
    

回复内容:

添加如下几天语句页面变为空白,删除正常
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);

添加到页面顶端

相关标签: php html5