首頁 > 後端開發 > php教程 > html5 - php中新增瞭如下語句出現空白頁 刪除頁面zhengchang

html5 - php中新增瞭如下語句出現空白頁 刪除頁面zhengchang

WBOY
發布: 2016-08-18 09:16:13
原創
1537 人瀏覽過

加入以下幾天語句頁變成空白,刪除正常
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);

加入到頁面頂端

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板