Rumah > pembangunan bahagian belakang > tutorial php > html5 - php中添加了如下语句出现空白页 删除页面zhengchang

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

WBOY
Lepaskan: 2016-08-18 09:16:13
asal
1555 orang telah melayarinya

添加如下几天语句页面变为空白,删除正常
echo "isset($tireqty)".isset($tireqty)."
";
echo "isset($nothere)".isset($nothere)."
";
echo "isset($tireqty)".empty($tireqty)."
";
echo "isset($nothere)".empty($nothere)."
";

下面列出完整代码

<code>    
            <title>Bob's Auto Parts -Order Result</title>
    
    
            <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')."";
                    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>
Salin selepas log masuk
Salin selepas log masuk

// echo "isset($tireqty)".isset($tireqty)."
";
// echo "isset($nothere)".isset($nothere)."
";
// echo "isset($tireqty)".empty($tireqty)."
";
// echo "isset($nothere)".empty($nothere)."
";

<code>            ?>
    </code>
Salin selepas log masuk
Salin selepas log masuk

回复内容:

添加如下几天语句页面变为空白,删除正常
echo "isset($tireqty)".isset($tireqty)."
";
echo "isset($nothere)".isset($nothere)."
";
echo "isset($tireqty)".empty($tireqty)."
";
echo "isset($nothere)".empty($nothere)."
";

下面列出完整代码

<code>    
            <title>Bob's Auto Parts -Order Result</title>
    
    
            <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')."";
                    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>
Salin selepas log masuk
Salin selepas log masuk

// echo "isset($tireqty)".isset($tireqty)."
";
// echo "isset($nothere)".isset($nothere)."
";
// echo "isset($tireqty)".empty($tireqty)."
";
// echo "isset($nothere)".empty($nothere)."
";

<code>            ?>
    </code>
Salin selepas log masuk
Salin selepas log masuk

前面的引号类的变量$nothere没有定义会报错,你没有开启debug模式就不会报错,也不会显示
isset和empty返回的都是bool类型,自然是不会显示的

echo "isset($tireqty)"...如果$tireqty没有定义会出错,因为这里双引号里面的isset是作为字符输出的

error_reporting(E_ALL);
ini_set("display_errors", 1);

添加到页面顶端

Label berkaitan:
sumber:php.cn
Kenyataan Laman Web ini
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn
Tutorial Popular
Lagi>
Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan