Location:Home >> News >> photo

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

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

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

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

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

复制代码代码如下:
<?php 
$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框架程序设计有所帮助。

Special Reminder & Disclaimer:
The information of this website comes from the Internet. The content (pictures, videos and words) released by this website is mainly the content submitted by users and reproduced by users. The purpose is to convey more information, which does not mean that this website agrees with its views. The originality, statements, and content of this article have not been verified by this website. We do not guarantee or promise the authenticity, completeness, or timeliness of this article or all or part of its content or text. Please verify the relevant content on your own. This website does not assume direct or joint liability for infringement of such works. If any content on this website infringes on your rights, please contact us promptly (email: nssa@soufind.com )This site will complete the processing within 72 hours. The original content on this website cannot be reproduced without permission, or the source must be indicated when reprinting: nssa.vip Aerospace Alliance

Author:

Recommended for you

Post comments

admin

Contact Us

Contact Us

Online consultation: QQ交谈

Email: service#soufind.com

follow us on WeChat
Scan and follow us on WeChat

Scan and follow us on WeChat