我知道,在默认情况下,编码点火器-2可以生成字母数字类型的captcha。如何将其扩展为生成有意义的单词?
例如:
morningoverlooking生成captcha的代码示例:
$vals = array(
'img_path' => './assets/captcha/',
'img_url' => 'http://url/assets/captcha/',
'img_width' => '130',
'font_path' => './assets/fonts/Moms_typewriter.ttf',
'img_height' => '33',
'expiration' => CAPTCHA_MAX_TIME_EXPIRATION
);
$cap = create_captcha($vals);发布于 2015-06-29 04:19:34
只需在循环中使用array和pass元素
<?php
$ab = array('Morning','Night','welcome','im here');
$word = '';
$n = 0;
while ($n < 1)
{
$word .= $ab[mt_rand(0,9)];
$n++;
}
$vals = array(
'word' => $word,
'img_path' => './assets/captcha/',
'img_url' => base_url().'assets/captcha/',
'img_width' => '130',
'font_path' => './assets/fonts/Moms_typewriter.ttf',
'img_height' => '33',
'expiration' => CAPTCHA_MAX_TIME_EXPIRATION
);https://stackoverflow.com/questions/31107502
复制相似问题