Home  >  Article  >  Backend Development  >  CI framework verification code CAPTCHA auxiliary function usage example, cicaptcha_PHP tutorial

CI framework verification code CAPTCHA auxiliary function usage example, cicaptcha_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:15:111045browse

CI framework verification code CAPTCHA auxiliary function usage example, cicaptcha

The example in this article describes the usage of the CI framework verification code CAPTCHA auxiliary function and is shared with everyone for your reference. The details are as follows:

Using the CAPTCHA auxiliary function is very convenient to generate verification codes, but the pictures are stored in the folder, not the output stream, which feels not perfect enough and can be used.

Instructions: Generate a 4-digit random number and create a captcha folder in the CI root directory.

Copy code The code is as follows:
$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'];
?>

The running results are as shown below:

I hope this article will be helpful to everyone’s CI framework programming.

How to use ci to create an image verification code?

PHP has many verification code classes! It can be used as a CI class library with almost no modifications. Google search php captcha to view the original post>>

How to use ci to create an image verification code?

PHP has many verification code classes! It can be used as a CI class library with almost no modifications. Google search php captcha to view the original post>>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/906672.htmlTechArticleCI framework verification code CAPTCHA auxiliary function usage example, cicaptcha This article describes the usage of CI framework verification code CAPTCHA auxiliary function , shared with everyone for your reference. The details are as follows: Make...
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