<?php
function table($row,$col,$c){
$str= "<table border=1>";
for ($i=0; $i <$row ; $i++) { //$i表示行 0~9
$color=$i % 2==0?"#ffffff":$c;//三元运算符 $i % 2==0为true 执行$color="#fff" 否则 执行 $color="#ccc";
$str=$str. "<tr bgcolor=$color>";
for ($j=0; $j <$col ; $j++) { //$j:0~9
$str=$str. "<td>".($j+$i*$col)."</td>";
}
$str=$str. "</tr>";
}
$str=$str. "</table>"; return $str;
}
echo table(10,10,"red");
echo "<br>";
echo table(5,5,"green"); header("content-type:html/text;charset=utf-8");
function genPassword($min = 5, $max = 8)
{
$validchars="abcdefghijklmnopqrstuvwxyz1234567890";
$max_char=strlen($validchars)-1;
$length=mt_rand($min,$max);
$password = "";
for($i=0;$i<$length;$i++ )
{
$password.=$validchars[mt_rand(0,$max_char)];
}
return $password;
}
echo "生成的密码:".genPassword(5,5)."<br>"; ?>

随机密码,表格

随机推荐

  1. this 的理解

    function foo(num){ console.log("foo:",+num); this.count++}foo.count =0for (var i=0; i<1 ...

  2. 分析Ubuntu18.04启动后的各种任务

    jello@jello:~$ ps -A  PID TTY          TIME CMD    1 ?        00:00:02 systemd    由idle进程(进程号为0的进程,那 ...

  3. Windows下安装mayavi2

    由于要使用mayavi2画三维图,但是没有找到二进制包,所以只能安装pythonxy或者canopy之类的版本,后来在http://www.lfd.uci.edu/~gohlke/pythonlibs ...

  4. Hive的三种Join方式

    Hive的三种Join方式 hive Hive中就是把Map,Reduce的Join拿过来,通过SQL来表示. 参考链接:https://cwiki.apache.org/confluence/dis ...

  5. 5.scala中的对象

    排版乱?请移步原文获得更好的阅读体验 1.单例对象 scala中没有静态类或者静态方法,都是通过object实现的,它表示某个类的单例对象.如object People是class People的单例 ...

  6. 在Extjs 的 TabPanel在 title标题栏上加按扭button

    如何在tabPanel的 标题栏的右侧添加操作按扭,效果如图,我总结了两种实现的方案: 第一种方案: 使用tabPanel的tabPbar: Ext.define("CisApp.view. ...

  7. 在线前端 样式和js

    bootstrap+ jquery <link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstra ...

  8. Oracle函数中文转拼音(首字母)

    CREATE OR REPLACE FUNCTION FUN_GET_PYCODE(p_str IN VARCHAR2, p_flag NUMBER DEFAULT NULL) RETURN VARC ...

  9. poj 2229 Sumsets 完全背包求方案总数

    Sumsets Description Farmer John commanded his cows to search for different sets of numbers that sum ...

  10. switchhosts使用技巧

    https://jingyan.baidu.com/article/1974b289a3cfd1f4b0f7744d.html