Blogger Information
Blog 19
fans 1
comment 0
visits 12120
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
第5章 php基础5- PHP培训九期线上班11.15
会上树的猪
Original
525 people have browsed it

实例

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title>无标题</title>
</head>
<body>
    <form action="" method="get">
        <p>
            <label for="email">邮箱:</label>
            <input type="email" id="email" name="email" placeholder="邮箱必须包含@" value="">
        </p>
        <p>
            <label for="password">密码:</label>
            <input type="password" id="password" name="password" placeholder="不能少于6位" value="">
        </p>
        <button>登录</button>
    </form>
</body>
</html>
<?php
    print_r($_GET);
?>

运行实例 »

点击 "运行实例" 按钮查看在线实例

无标题.png

实例

<?php
    echo '<h2>1.判断</h2>';
    $wages = 1000;
    var_dump($wages>1000 ? '买':'不买');
    var_dump($wages>=1000 ? '买':'不买');
    echo '<br/>';

    $wages = 600;
    if ($wages>1000) {
        echo '买';
    }elseif($wages>800){
        echo '买一点';
    }else{
        echo '不买';
    }
    echo '<br/>';

    $wages = 1000;   
    switch ($wages) {
        case $wages>1000:
            echo '买';
            break;
        case $wages>800:
            echo '买一点';
            break;     
        default:
            echo '不买';
            break;
    }
    echo '<br/>';

    echo '<h2>2.循环</h2>';
    $int = 1;
    while ( $int<= 10) {
        echo $int;
        echo '<hr/>';
        $int++;
    }

    $int = 1;
    do {
        echo $int;
        echo '<hr>';
        $int++;
    }while ( $int < 1);

    for($int=1; $int<=10; $int++){
        echo $int;
        echo '<hr>'; 
    }
    for( $int=1; $int<10; $int++){
        echo $int;
        if($int == 6){
            echo '比较特殊';
        }
        echo '<hr>';
    }

    echo '<h2>3.跳出流程</h2>';
    for( $int=1; $int<10; $int++){
        if($int == 6){
            //结束当前循环,进入下次循环
            continue;
        }
        echo $int;
        echo '<hr>';
    }

    for( $int=1; $int<10; $int++){
        if($int == 6){
            //结束循环
            break;
        }
        echo $int;
        echo '<hr>';
    }

?>

运行实例 »

点击 "运行实例" 按钮查看在线实例

111.png


Correcting teacher:查无此人查无此人

Correction status:qualified

Teacher's comments:完成的不错
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post