This article mainly introduces the use of CAPTCHA auxiliary function in the CI framework verification code, and describes in detail how to implement the verification code based on CAPTCHA auxiliary function in the form of examples, you can refer to the examples in this article to describe how to use the CAPTCHA helper function of the CI framework verification code. The details are as follows:
The CAPTCHA helper function is used to conveniently generate verification codes. However, the images are stored in folders rather than output streams, and they are not perfect enough for use.
Note: four random numbers are generated. The captcha folder is created under the CI root directory.
The Code is as follows:
<? Php
$ This-> load-> helper ('captcha ');
$ Vals = array (
'Word' => rand (1000,100 00 ),
'Img _ path' => './captcha /',
'Img _ url' => 'HTTP: // localhost/ci/captcha /',
// 'Font _ path' => './path/to/fonts/texb. ttf ',
'Img _ width' => '000000 ',
'Img _ height' => 30,
'Expiration' => 7200
);
$ Cap = create_captcha ($ vals );
Echo $ cap ['image'];
?>
Shows the running result:
I hope this article will help you with CI framework programming.