首页 / PHP / 分享一个php验证码类及调用示例
分享一个php验证码类及调用示例
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了分享一个php验证码类及调用示例,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2611字,纯文字阅读大概需要4分钟。
内容图文
本文分享一个不错的php 验证码类,后面附有完整的调用示例,有需要的朋友,参考下吧。
1,php验证码类 检查验证码: 检查输入的验证码与 $_SESSION['login'] 中保存的值是否相等。 */ error_reporting(E_ALL); session_start(); (!isset($_GET['cap']))?die('Error !'):1; $captcha_array=array('login.png','contact.png','comment.png'); (!in_array($_GET['cap'],$captcha_array))?die('Error !'):1; $captcha_cod=new captcha(basename($_GET['cap'],'.png')) ; //验证码类 class captcha { private $session_name; private $image_width; private $image_height; private $cod_length; private $cod_mode; private $font_path; private $avtage_font_size; private $sec_cod; private $res_image; function __construct($name,$width=200,$height=50,$length=5,$mod=2,$font='arial.ttf',$av_font_size=25) { $this-> session_name = $name ; $this-> image_width = $width ; $this-> image_height = $height ; $this-> cod_length = $length ; $this-> mode = $mod ; $this-> font_path = $font ; $this-> avrage_font_size = $av_font_size ; $this->Gen_Cod(); } function Write_Text($text) { $x_pos=10; for($pos=0;$pos 2,php验证码类的调用示例: '; else echo'Your Entered Cod Was Incorrect |
内容总结
以上是互联网集市为您收集整理的分享一个php验证码类及调用示例全部内容,希望文章能够帮你解决分享一个php验证码类及调用示例所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。