第二周 PHP基础

LNMP搭建

一键安装

wget http://dl.wdlinux.cn:5180/lanmp_laster.tar.gz
tar zxvf lanmp_laster.tar.gz
sh lanmp.sh

卸载

sh lanmp.sh uninstall

第三方环境WDCP安装教程

数组

数组元素类型可以不同

第二周作业

没有用到数组

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Calculator</title>
</head>
<style>
    .header {
        width: 100%;
        height: 80px;
        margin-top: 5px;
        background-color: gray;
        text-align: center;
        font-weight: bold;
    }

    .footer {
        width: 100%;
        height: 30px;
        margin-top: 810px;
        background-color: gray;
        text-align: center;
        float: none;
    }

    .content {
        width: 100%;
        height: 800px;
        margin-top: 5px;
        background-color: gray;
        text-align: center;
        float: left;
    }


    #Title {
        font-size: xx-large;
    }
</style>
<body>
    <div class="header"><br /><span id="Title">Calculator</span></div>
    <div class="content">

        <Br /><Br /><Br /><Br /><Br /><Br />

        <form action="" method="post">

            The First Number
            <div>
                <input type="text" name="TFN" />
            </div>
            Mathematical Symbol ( + - * / )
            <div>
                <input type="text" name="MS" />
            </div>
            The Second Number
            <div>
                <input type="text" name="TSN" />
            </div>
            <input type="submit">

        </form>

        <?php 
        $result = fopen("result.txt", "w");
        if( isset($_POST['TFN']) && isset($_POST['MS']) && isset($_POST['TSN'])){
            $TFN=$_POST['TFN'];
            $MS=$_POST['MS'];
            $TSN=$_POST['TSN'];
            //echo "$TFN $MS $TSN<br>";
            $PRINT="$TFN $MS $TSN\r\n";
            fwrite($result,"$TFN $MS $TSN\r\n");
            //fwrite($result,"&#10");
            if($MS=="+"){
                //echo ($TFN+$TSN);
                $RES=$TFN+$TSN;

            }
            else if($MS=="-"){
                //echo ($TFN-$TSN);
                $RES=$TFN-$TSN;

            }
            else if($MS=="*"){
                //echo ($TFN*$TSN);
                $RES=$TFN*$TSN;

            }
            else if($MS=="/"){
                //echo ($TFN/$TSN);
                $RES=$TFN/$TSN;

            }
            fwrite($result,"$RES\r\n");             
            ini_set('date.timezone','Asia/Shanghai');
            //echo date('Y-m-d H:i:s');
            $Time=date('Y-m-d H:i:s');
            fwrite($result,"$Time\r\n");
        }
        ?>




    </div>
    <div class="footer">Developing...</div>
</body>
</html>

BLOG

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值