首页 > 编程 > PHP > 正文

今天更新点心的内容---php

2019-11-15 02:02:01
字体:
来源:转载
供稿:网友
今天更新点心的内容---php

先贴代码

<?php    function table(){        echo "<table align='center' border='1' width='600' cellspacing='0';>";        echo "<caption><h1>这是表格的标题</h1></caption>";                for($out=0; $out < 10; $out++ ){            $bgcolor = $out%2 == 0 ? "#ffffff" : "green";            $fontcolor = $out%2 == 0 ? "#ffffff" : "#000000";            echo "<tr bgcolor=".$bgcolor.">";                        for($in=0;$in<10;$in++){                echo "<td>".($out*10+$in)."</td>";            };            echo "</tr>";        };                echo "</table>";    }        table();?>

这是一段 PHP 定义函数的代码

tips:

1、注意PHP 的语法格式

2、注意在PHP 中插入Html 代码的方式

3、利用for 循环的时候,注意想清楚,外部循环和里部循环 的差异性


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表