在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
文章来源:http://www.cnblogs.com/hello-tl/p/7593022.html <?php class TL_Captcha_img{ private $image; //验证码图片 private $captch_code; //验证码信息 public function __construct($table){ session_start(); if(is_array($table)){ $index = rand(0,count($table)-1); //获取随机的value $table1 = array_keys($table); $value = $table1[$index]; $_SESSION['authcode'] = $this->captch_code; //获取随机的键值 $key = array_flip($table); $key = $key[$value]; $this->image = dirname(__FILE__).'/'.$key.'.png'; } } public function __destruct() { $this->image = file_get_contents($this->image); header('content-type:image/png'); echo $this->image; imagedestroy($this->image); } } // $table = array( // 'sql' => 'sql', // 'png' => 'png', // 'jpg' => 'jpg', // 'gif' => 'gif', // 'css' => 'css', // 'html' => 'html', // 'js' => 'js', // 'php' => 'php', // 'txt' => 'txt', // 'word' => 'word', // 'excal' => 'excal', // 'img' => 'img', // ); // $Captcha_img = new Captcha_img($table); 文章来源:http://www.cnblogs.com/hello-tl/p/7593022.html |
2022-08-15
2022-08-17
2022-11-06
2022-08-17
2022-07-18
请发表评论