<?php
/**
* [verification-code] (C)2015-2100 jingwhale.
*
* This is a freeware
* $Id: verification-code.php 2015-02-05 20:53:56 jingwhale$
*/
//设置字符集编码
header('Content-Type: text/html; charset=utf-8');
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>verification code</title>
<link type="text/css" href="https://www.jb51.net/style/basic.css" />
</head>
<body>
<div>
<form method="post" action="verification-code.php?action=verification">
<dl>
<dd>验证码:<input type="text" /><img src="https://www.jb51.net/codeimg.php" /></dd>
<dd><input type="submit" value="验证" /></dd>
</dl>
</form>
</div>
</body>
</html>
显示如下:
2)创建产生验证码图片页面
创建codeimg.php为verification-code.php html代码里的img提供验证码图片
首先必须在codeimg.php页面开启session;
其次,将我们封装好的global.func.php全局函数库引入进来;
最后,运行_code();
复制代码 代码如下: