[PHP]代码
<?php
/**
* Author: wonli
* Contact: wonli@live.com
* Date: 2011-09
* Description: getvcode()
*/
$st = microtime(true);
function getvcode()
{
$s = array();
$str = '3456789abcdefghjkmnpqrstuvwxy';
for($k = 65; $k<74; $k++)
{
for($i = 1; $i<=9; $i++)
{
$_x=substr(str_shuffle($str), $i, $i+2);
$s[chr($k)][$i] = $_x[0].$_x[1];
}
}
return $s;
}
$s = getvcode();
$b = serialize($s);
echo '<style type="text/css">table{width:350px;height:350px;border:1px solid blue;margin:20px;border-collapse: collapse; }td{text-align:center;border:1px solid #dddddd;} .b{background:#ffffee;} .c{background:#eeffff;}</style>';
echo '<table><tr><td> </td>';
for($i=1;$i<=9;$i++)
{
echo '<td class="b">'.$i.'</td>';
}
echo '</tr>';
foreach($s as $k=>$v)
{
echo '<tr><td class="c">'.$k.'</td>';
for($i=1;$i<=9;$i++)
{
echo '<td>'.$v[$i].'</td>';
}
echo '</tr>';
}
echo '</table>';
echo '<p style="margin-top:20px"></p>';
$et = microtime(true);
echo round(($et - $st) * 1000, 2).' 毫秒',' <a href="?view">查看</a> ',' <a href="?close">关闭</a>';
if(isset($_GET['view']))
{
echo '<p style="margin-top:100px;"><textarea name="" id="" cols="130" rows="10">'.$b.'</textarea></p>';
} elseif(isset($_GET['close'])) {
}
图书《网页制作与PHP语言应用》,由武汉大学出版社于2006出版,该书为普通高等院校网络传播系列教材之一,主要阐述了网页制作的基础知识与实践,以及PHP语言在网络传播中的应用。该书内容涉及:HTML基础知识、PHP的基本语法、PHP程序中的常用函数、数据库软件MySQL的基本操作、网页加密和身份验证、动态生成图像、MySQL与多媒体素材库的建设等。
447
function getvcode()
{
$s = array();
$str = '3456789abcdefghjkmnpqrstuvwxy';
for($k = 65; $k<74; $k++)
{
for($i = 1; $i<=9; $i++)
{
$_x=substr(str_shuffle($str), $i, $i+2);
$s[chr($k)][$i] = $_x[0].$_x[1];
}
}
return $s;
}
立即学习“PHP免费学习笔记(深入)”;
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号