您好,我正在尝试验证码验证,但是当我调用create_captcha函数时,它返回bool/false而不是数组。我不知道出了什么问题?.I正在使用linux/php-7.3,也尝试启用gd库,但没有成功。
$this->load->helper('captcha');
$vals = array(
'img_url' => base_url('public/captcha'),
'img_path' => FCPATH.'public/captcha',
'img_height' => 45,
'word_length' => 5,
'img_width' => '45',
'font_size' => 10
);
var_dump($vals);
$cap = create_captcha($vals);
echo $cap['image'];发布于 2020-12-29 23:23:15
您的代码片段中缺少验证码单词
$vals = array(
'word' => 'Captcha word',
'img_path' => './captcha/',
'img_url' => 'http://example.com/captcha/',
'font_path' => './path/to/fonts/texb.ttf',
'img_width' => '150',
'img_height' => 30,
'expiration' => 7200
);
$cap = create_captcha($vals);
echo $cap['image'];注意"captcha“文件夹必须是可写的(666或777)
https://stackoverflow.com/questions/65494165
复制相似问题