第二周 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安装教程

数组

数组元素类型可以不同

第二周作业

没有用到数组


<html>
<head>
    <meta charset="utf-8" />
    <title>Calculatortitle>
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">Calculatorspan>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>

         
        $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
";
$PRINT="$TFN $MS $TSN\r\n"; fwrite($result,"$TFN $MS $TSN\r\n"); //fwrite($result," "); 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

你可能感兴趣的:(第二周 PHP基础)