Home > php教程 > PHP源码 > php生成密保卡

php生成密保卡

PHP中文网
Release: 2016-05-25 17:13:07
Original
1207 people have browsed it

[PHP]代码

<?php
/**
* Author:       wonli
* Contact:      wonli@live.com
* Date:         2011-09
* Description:  getvcode()
*/
$st = microtime(true);
function getvcode()
{
    $s = array();
    $str = &#39;3456789abcdefghjkmnpqrstuvwxy&#39;;
    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 &#39;<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>&#39;;
echo &#39;<table><tr><td>  </td>&#39;;
for($i=1;$i<=9;$i++)
{
    echo &#39;<td class="b">&#39;.$i.&#39;</td>&#39;;
}
echo &#39;</tr>&#39;;
foreach($s as $k=>$v)
{
    echo &#39;<tr><td class="c">&#39;.$k.&#39;</td>&#39;;
    for($i=1;$i<=9;$i++)
    {
        echo &#39;<td>&#39;.$v[$i].&#39;</td>&#39;;
    }
    echo &#39;</tr>&#39;;
}
echo &#39;</table>&#39;;
echo &#39;<p style="margin-top:20px"></p>&#39;;
$et = microtime(true);
echo round(($et - $st) * 1000, 2).&#39; 毫秒&#39;,&#39; <a href="?view">查看</a> &#39;,&#39; <a href="?close">关闭</a>&#39;;
if(isset($_GET[&#39;view&#39;]))
{
    echo &#39;<p style="margin-top:100px;"><textarea name="" id="" cols="130" rows="10">&#39;.$b.&#39;</textarea></p>&#39;;
} elseif(isset($_GET[&#39;close&#39;])) {
}
Copy after login

[图片] scode.bmp

php生成密保卡

[PHP]代码

function getvcode()
{
    $s = array();
    $str = &#39;3456789abcdefghjkmnpqrstuvwxy&#39;;

    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;
}
Copy after login

                   

                   

Related labels:
php
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template