所以我不想在 CI 上使用安全图像,因为我不想使用默认的 CAPTCHA 助手,因为它没有音频选项,但我在使用安全图像时显示音频时遇到问题。
我将从站点下载的整个安全映像文件夹复制到CI库中。
显示图像很好,还可以检查输入的代码。但我的问题是显示音频文件。我不知道该怎么做。
以下是我显示图像和检查的方式(已使用安全图像库):
function captcha_image(){
$img = new Securimage();
return $img->show();
}
public function captcha_check(){
$img = new Securimage();
$input = $this->input->post('imagecode');
$result = $img->check($input);
if($result)
$message = "success";
else
$message = "try again";
}
我的观点:
<img src="<?php echo site_url('form/captcha_image') ?>" alt='captcha' />
如果您正在使用此库https://github.com/subdesign/CI-HTI-Securimage
所以获取音频文件的方法是
$img->输出音频文件();
但是您必须配置(设置)音频路径目录并确保其可重写
$settings['audio_path'] = '....';// If you didn't configure this it will secureimage library path and follow by dir /audio/
$settings['audio_noise_path'] = '...';//save as above audio path
$settings['audio_use_noise'] = true; // true or false;
$settings['degrade_audio'] = true; // true or false;
// Then init the secureimage with the options
$img = new Securimage($settings);
$img->show(); // this will show the image src
$img->outputAudioFile(); // this will output the audio file to the browser