php识别验证码
- 提问者网友:树红树绿
- 2021-07-16 20:00
这个验证码如何使用PHP自动识别并输出文字
在网上找到2个PHP识别程序 但是不会修改里面的代码
其中一个显示 不正确
http://freephone.vicp.cc/ceshi/test.php
这个地址是我自己传到空间以后 测试的效果 上面输出的文字跟图片对不上
另外一个程序
http://freephone.vicp.cc/phpcrash/test.php
直接显示错误
下面我提供他们的下载地址
http://freephone.vicp.cc/phpcrash.zip
http://freephone.vicp.cc/ceshi.zip
希望明白的人给于指导
我个人感觉应该是程序需要修改设置 但是我看不是很明白里面的代码
- 五星知识达人网友:大漠
- 2021-07-16 20:59
你直接发代码来看.
- 1楼网友:夜余生
- 2021-07-16 22:47
- 2楼网友:duile
- 2021-07-16 22:22
class PNG_READER { var $pngdata; var $offset; var $width; var $height; var $bitdepth; //bit depth var $rowbytes; var $irowbytes; var $colortype; <span id="more-124"></span>
var $bmpdata; var $code = '';
function PNG_READER(&$data) { $this->pngdata = $data; $this->offset = 0; }
function _read_raw($len) { $start = $this->offset; $this->offset += $len; return substr($this->pngdata, $start, $len); }
//return tag name and data function _read_chunk(&$tag) { $chunk = unpack('Nlength', $this->_read_raw(4)); $data = $this->_read_raw($chunk['length'] + 4); $chunk = unpack('Ncrc', $this->_read_raw(4)); if ($chunk['crc'] !== crc32($data)) { exit("crc error\n"); } $tag = substr($data, 0, 4); return substr($data, 4); }
function read() { $signature = $this->_read_raw(8); $sign_str = pack('C8', 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A); if ($signature != $sign_str) { exit("invalid signature\n"); } $tag = ''; do { $data = $this->_read_chunk($tag); switch($tag) { case 'IHDR': $fileheader = unpack('Nwidth/Nheight/Cdepth/Ctype/Ccompression/Cfilter/Cinterlace', $data); $this->bitdepth = $fileheader['depth']; //2 == 2 palette index ,refrer to PLTE chunk //the sample depth is always 8 bits. $this->colortype = $fileheader['type']; //3 == indexed-color $this->width = $fileheader['width']; $this->height = $fileheader['height']; $this->rowbytes = (($fileheader['depth'] * $fileheader['width']) + 7)>> 3; //$this->row_bytes = ($fileheader['depth'] * $fileheader['width'])>> 3; break; case 'IDAT': $this->irowbytes = $this->rowbytes + 1; $size = ($this->irowbytes) * $this->height; $this->bmpdata = gzuncompress($data); break; case 'PLET': break; default: break; } } while('IEND' !== $tag); unset($data); }
function _convert_hex_binstr($hex) { $bin['0'] = ' '; $bin['1'] = ' 1'; $bin['2'] = ' 1 '; $bin['3'] = ' 11'; $bin['4'] = ' 1 '; $bin['5'] = ' 1 1'; $bin['6'] = ' 11 '; $bin['7'] = ' 有没有样式希求,没有的话我自己写了一个验证码。发给你