首页 > 后端开发 > php教程 > html5 - php中添加了如下语句出现空白页 删除页面zhengchang

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

WBOY
发布: 2016-08-18 09:16:13
原创
1538 人浏览过

添加如下几天语句页面变为空白,删除正常
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>
登录后复制
登录后复制

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

<code>            ?>
    </code>
登录后复制
登录后复制

回复内容:

添加如下几天语句页面变为空白,删除正常
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>
登录后复制
登录后复制

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

<code>            ?>
    </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
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板