验证码辅助函数应该怎么用?
$this->load->helper('captcha');
$vals = array(
'img_path' => './captcha/',
'img_url' => 'http://example.com/captcha/'
);
$cap = create_captcha($vals);
$data = array(
'captcha_time' => $cap['time'],
'ip_address' => $this->input->ip_address(),
'word' => $cap['word']
);
$query = $this->db->insert_string('captcha', $data);
$this->db->query($query);
echo 'Submit the word you see below:';
echo $cap['image'];
echo '<input type="text" name="captcha" value="" />';
不管怎么图片都显示不出来 看看报什么错,直接把 image src 放到浏览器里看看 $vals = array(
'img_path' => './captcha/',
'img_url' => 'http://example.com/captcha/'
);
这两个参数应该怎么设置? 按你的实际情况设置啊,path 应该没问题,不过你可能要自己创建这个文件夹。
url 要写你自己的实际 url 我设置好了有一个问题这个生成的图片什么时候删除?这个会生成一个图片文件到上面的path路径里 要看代码才知道什么时候删除,也有可能不会删除,哈哈~ 'img_url' => 'http://example.com/captcha/' 这里的captcha是控制器的名字还是存放验证码图片的文件夹的名字,为什么我不管写哪个图片都显示不出来?{:1_1:}
页:
[1]