Blogger Information
Blog 25
fans 2
comment 0
visits 18529
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
PHP教学-流程控制 (手写) 、练习计数循环 (手写)
果莫个人博客
Original
663 people have browsed it

1.jpg


2.jpg


3.jpg


index.php

实例

<?php
include 'ggml/header.php'
?>

<article>
    <div>
        <span><?php
            echo $kandian['kandian'];
            ?></span>
        <span><?php
            echo $kandian['riqi'];
            ?>></span>
    </div>
</article>

<article>
    <main>
        <?php
        foreach( $dianying as $dy1){
            echo '<ul><li><a href=""><img src="'.$dy1['dyimg'].'" alt="">'.$dy1['dyname'].'</a></li></ul>';
        }
        ?>
    </main>

    <main>
        <h3><?php
            echo $kandian['zuixindianying'];
            ?></h3>

        <?php
        foreach($dianying as $dy1){
            echo '<ul>
            <li><a href="">'.$dy1['dyname'].'</a></li></ul>';
        }
        ?>

    </main>
</article>

<?php
include 'ggml/footer.php'
?>

运行实例 »

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


fenlei.php

实例

<?php
include 'ggml/header.php';
$dyCate=isset($_GET['dycate'])? $_GET['dycate']:'';
?>

    <article>
        <div>
        <span><?php
            foreach($dyzu as $dyzufenlei){
                if($dyCate==$dyzufenlei['dycate']){
                    echo $dyzufenlei['dyzu'];
                }
            }
            ?></span>
            <span><?php
                echo $kandian['riqi'];
                ?>></span>
        </div>
    </article>

    <article>
        <main>

            <?php
            foreach($dianying as $dyvip){
                if($dyCate==$dyvip['dycate']){
                    echo '<ul><li><a href=""><img src="'.$dyvip['dyimg'].'" alt="">'.$dyvip['dyname'].'</a></li></ul>';
                }
            }
            ?>
        </main>

        <main>

            <h3><?php
            foreach($dyzu as $dyzuvip){
                if($dyCate == $dyzuvip['dycate']){
                    echo $dyzuvip['dyzu'];
                }
            }
            ?>-最新电影</h3>



            <?php
            foreach($dianying as $dy1){
                if($dyCate== $dy1['dycate']){
                    echo '<ul>
            <li><a href="">'.$dy1['dyname'].'</a></li></ul>';
                }
            }
            ?>


        </main>
    </article>

<?php
include 'ggml/footer.php'
?>

运行实例 »

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



  1. html

实例

<!--<!DOCTYPE html>-->
<!--<html lang="en">-->
<!--<head>-->
<!--    <meta charset="UTF-8">-->
<!--    <title>电影天堂</title>-->
<!--    <link rel="stylesheet" href="dycss/dy1.css">-->
<!--</head>-->
<!--<body>-->
<!--<header>-->
<!--<div>-->
<!--    <a href="#"><img src="dyimg/logo.jpg" alt=""></a>-->
<!--</div>-->
<!--<div>-->
<!--    <ul>-->
<!--        <li><a href=""><i>首页</i></a></li>-->
<!--        <li><a href="">动作片</a></li>-->
<!--        <li><a href="">科幻片</a></li>-->
<!--        <li><a href="">恐怖片</a></li>-->
<!--        <li><a href="">喜剧片</a></li>-->
<!--        <li><a href="">爱情片</a></li>-->
<!--        <li><a href="">剧情片</a></li>-->
<!--        <li><a href="">战争片</a></li>-->
<!--        <li><a href="">动漫片</a></li>-->
<!--        <li><a href="">综艺片</a></li>-->

<!--    </ul>-->
<!--</div>-->
<!--</header>-->

<article>
<div>
    <span>今日看点</span>
    <span>今天是11月18号星期日</span>
</div>
</article>


<article>
<main>
    <ul>
        <li><a href=""><img src="dyimg/1.jpg" alt="">无罪之凶</a></li>
        <li><a href=""><img src="dyimg/2.jpg" alt="">古惑仔:以暴制</a></li>
        <li><a href=""><img src="dyimg/3.jpg" alt="">武神黑侠</a></li>
        <li><a href=""><img src="dyimg/4.jpg" alt="">极速车王201</a></li>
        <li><a href=""><img src="dyimg/5.jpg" alt="">无间道长之神剑</a></li>
        <li><a href=""><img src="dyimg/6.jpg" alt="">无敌拳王</a></li>
        <li><a href=""><img src="dyimg/7.jpg" alt="">听不到的说话</a></li>
        <li><a href=""><img src="dyimg/8.jpg" alt="">天音琴魔</a></li>
        <li><a href=""><img src="dyimg/9.jpg" alt="">特工神谍</a></li>
        <li><a href=""><img src="dyimg/10.jpg" alt="">死神傻了</a></li>
        <li><a href=""><img src="dyimg/11.jpg" alt="">跑出一片天</a></li>
        <li><a href=""><img src="dyimg/12.jpg" alt="">魔域飞龙</a></li>
    </ul>
</main>
<main>
    <h3>最新电影</h3>
    <ul>
        <li><a href="">武神黑侠</a></li>
        <li><a href="">极速车王201</a></li>
        <li><a href="">无间道长之神剑</a></li>
        <li><a href="">无敌拳王</a></li>
        <li><a href="">听不到的说话</a></li>
        <li><a href="">天音琴魔</a></li>
        <li><a href="">特工神谍</a></li>
        <li><a href="">死神傻了</a></li>
        <li><a href="">跑出一片天</a></li>
        <li><a href="">魔域飞龙</a></li>
    </ul>
</main>
</article>

<!--<footer>-->
<!--    <h3>版权所有xxxxxxxxx</h3>-->
<!--</footer>-->
<!--</body>-->
<!--</html>-->

运行实例 »

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



footer.php


实例

<footer>
    <h3>版权所有xxxxxxxxx</h3>
</footer>
</body>
</html>

运行实例 »

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



shuju.php


实例

<?php
$kandian=[
  'kandian'=>'今日看点',
  'riqi'=>'今天是11月18号星期日',
    'zuixindianying'=>'最新电影'
];

$dianying=[

    [  'dyid'=>1,
        'dyname'=>'无罪之凶',
        'dyimg'=>'dyimg/1.jpg',
        'dycate'=>1
    ],
    [  'dyid'=>2,
        'dyname'=>'古惑仔:以暴制',
        'dyimg'=>'dyimg/2.jpg',
        'dycate'=>1
    ],
    [  'dyid'=>3,
        'dyname'=>'武神黑侠',
        'dyimg'=>'dyimg/3.jpg',
        'dycate'=>2
    ],
    [  'dyid'=>4,
        'dyname'=>'极速车王201',
        'dyimg'=>'dyimg/4.jpg',
        'dycate'=>3
    ],
    [  'dyid'=>5,
        'dyname'=>'无间道长之神剑',
        'dyimg'=>'dyimg/5.jpg',
        'dycate'=>4
    ],
    [  'dyid'=>6,
        'dyname'=>'无敌拳王',
        'dyimg'=>'dyimg/6.jpg',
        'dycate'=>1
    ],
    [  'dyid'=>7,
        'dyname'=>'听不到的说话',
        'dyimg'=>'dyimg/7.jpg',
        'dycate'=>5
    ],
    [  'dyid'=>8,
        'dyname'=>'天音琴魔',
        'dyimg'=>'dyimg/8.jpg',
        'dycate'=>6
    ],
    [  'dyid'=>9,
        'dyname'=>'特工神谍',
        'dyimg'=>'dyimg/9.jpg',
        'dycate'=>7
    ],
    [  'dyid'=>10,
        'dyname'=>'死神傻了',
        'dyimg'=>'dyimg/10.jpg',
        'dycate'=>8
    ],
    [  'dyid'=>11,
        'dyname'=>'跑出一片天',
        'dyimg'=>'dyimg/11.jpg',
        'dycate'=>9
    ],
    [  'dyid'=>12,
        'dyname'=>'魔域飞龙',
        'dyimg'=>'dyimg/12.jpg',
        'dycate'=>2
    ]
];

$dyzu=[
    ['dycate'=>1,'dyzu'=>'动作片','dydizhi'=>'dongzuopian'],
    ['dycate'=>2,'dyzu'=>'科幻片','dydizhi'=>'kehuanpian'],
    ['dycate'=>3,'dyzu'=>'恐怖片','dydizhi'=>'kongbupian'],
    ['dycate'=>4,'dyzu'=>'喜剧片','dydizhi'=>'xijupian'],
    ['dycate'=>5,'dyzu'=>'爱情片','dydizhi'=>'aiqingpian'],
    ['dycate'=>6,'dyzu'=>'剧情片','dydizhi'=>'juqingpian'],
    ['dycate'=>7,'dyzu'=>'战争片','dydizhi'=>'zhanzhengpian'],
    ['dycate'=>8,'dyzu'=>'动漫片','dydizhi'=>'dongmanpian'],
    ['dycate'=>9,'dyzu'=>'综艺片','dydizhi'=>'zongyipian']
];




?>

运行实例 »

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


Correcting teacher:天蓬老师天蓬老师

Correction status:qualified

Teacher's comments:分支只有单分支和多分支, switch, if-else if 只是提供了一种简化方案
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