加入以下幾天語句頁變成空白,刪除正常
echo "isset($tireqty)".isset($tireqty)."
";
echo "isset($nothere)".isset($nothere )."
";
echo "isset($tireqty)".empty($tireqty)."
";
echo "isset($nothere)".empty($nothere)."";
下面列出完整程式碼
<code> <head> <title>Bob's Auto Parts -Order Result</title> </head> <body> <h1>Bos's Auto Parts</h1> <h2>Order Result</h2> <?php define('TIREPRICE',100); define('OILPRICE',10); define('SPARKPRICE',4); $tireqty = $_POST['tireqty']; $oilqty = $_POST['oilqty']; $sparkqty = $_POST['sparkqty']; echo " <p>Order processed at".date('H:i, jS F Y')."</p>"; echo " <p>Your order is as follow:</p>"; echo $tireqty." tireqty<br/>"; echo $oilqty." oilqty<br/>"; echo $sparkqty." spark plugs <br/>"; $totalqty = 0; $totalqty = $tireqty + $oilqty + $sparkqty; echo "Items ordered: ".$totalqty."<br/>"; $totalamount = 0.00; $totalamount = $tireqty * TIREPRICE + $oilqty * OILPRICE + $sparkqty * SPARKPRICE; echo "Subtotal: $".number_format($totalamount,2)."<br/>"; $taxrate = 0.10; //total sales tax is 10% $totalamount = $totalamount * (1 + $taxrate); echo "Total including tax: $".number_format($totalamount,2)."<br/>"</code>
// echo "isset($tireqty)".isset($tireqty)."
";
// echo "isset($nothere)".isset($nothere)."
";
// echo "isset($tireqty)".empty($tireqty)."
";
// echo "isset($nothere)".empty($nothere)."
";
<code> ?> </body></code>
加入以下幾天語句頁變成空白,刪除正常
echo "isset($tireqty)".isset($tireqty)."
";
echo "isset($nothere)".isset($nothere )."
";
echo "isset($tireqty)".empty($tireqty)."
";
echo "isset($nothere)".empty($nothere)."";
下面列出完整程式碼
<code> <head> <title>Bob's Auto Parts -Order Result</title> </head> <body> <h1>Bos's Auto Parts</h1> <h2>Order Result</h2> <?php define('TIREPRICE',100); define('OILPRICE',10); define('SPARKPRICE',4); $tireqty = $_POST['tireqty']; $oilqty = $_POST['oilqty']; $sparkqty = $_POST['sparkqty']; echo " <p>Order processed at".date('H:i, jS F Y')."</p>"; echo " <p>Your order is as follow:</p>"; echo $tireqty." tireqty<br/>"; echo $oilqty." oilqty<br/>"; echo $sparkqty." spark plugs <br/>"; $totalqty = 0; $totalqty = $tireqty + $oilqty + $sparkqty; echo "Items ordered: ".$totalqty."<br/>"; $totalamount = 0.00; $totalamount = $tireqty * TIREPRICE + $oilqty * OILPRICE + $sparkqty * SPARKPRICE; echo "Subtotal: $".number_format($totalamount,2)."<br/>"; $taxrate = 0.10; //total sales tax is 10% $totalamount = $totalamount * (1 + $taxrate); echo "Total including tax: $".number_format($totalamount,2)."<br/>"</code>
// echo "isset($tireqty)".isset($tireqty)."
";
// echo "isset($nothere)".isset($nothere)."
";
// echo "isset($tireqty)".empty($tireqty)."
";
// echo "isset($nothere)".empty($nothere)."
";
<code> ?> </body></code>
前面的引號類別的變數$nothere沒有定義會報錯,你沒有開啟debug模式就不會報錯,也不會顯示
isset和empty回傳的都是bool類型,自然是不會顯示的
echo "isset($tireqty)"...如果$tireqty沒有定義會出錯,因為這裡雙引號裡面的isset是作為字元輸出的
error_reporting(E_ALL);
ini_set("display_errors", 1);
加入到頁面頂端