Home  >  Article  >  php教程  >  CI框架验证码CAPTCHA辅助函数用法实例,cicaptcha

CI框架验证码CAPTCHA辅助函数用法实例,cicaptcha

WBOY
WBOYOriginal
2016-06-13 09:22:091253browse

CI框架验证码CAPTCHA辅助函数用法实例,cicaptcha

本文实例讲述了CI框架验证码CAPTCHA 辅助函数的用法,分享给大家供大家参考。具体如下:

使用CAPTCHA 辅助函数很方便生成验证码,但是图片是存储在文件夹下,不是输出流,感觉不够完美,可以拿来用用。

说明:产生4位的随机数,CI根目录下建立captcha文件夹。

复制代码 代码如下:

$this->load->helper('captcha');
$vals = array(
    'word' => rand(1000, 10000),
    'img_path' => './captcha/',
    'img_url' => 'http://localhost/ci/captcha/',
    //'font_path' => './path/to/fonts/texb.ttf',
    'img_width' => '150',
    'img_height' => 30,
    'expiration' => 7200
    );
$cap = create_captcha($vals);
echo $cap['image'];
?>

运行结果如下图所示:

希望本文所述对大家的CI框架程序设计有所帮助。

怎使用ci创建图片验证码?

PHP 有很多验证码类啊!可以几乎不用修改当作 CI 的类库使用。google 搜索 php captcha 查看原帖>>
 

怎使用ci创建图片验证码?

PHP 有很多验证码类啊!可以几乎不用修改当作 CI 的类库使用。google 搜索 php captcha 查看原帖>>
 

Statement:
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