Codeigniter 代码点火器2-验证码助手?
我似乎无法让CI2的验证码助手工作。。。有人能指出我做错了什么吗 我想我已经完成了文档上的所有步骤,但是我没有得到任何东西。如果打印(get_defined_vars())没有显示任何东西…:( 我的控制器Codeigniter 代码点火器2-验证码助手?,codeigniter,captcha,codeigniter-2,Codeigniter,Captcha,Codeigniter 2,我似乎无法让CI2的验证码助手工作。。。有人能指出我做错了什么吗 我想我已经完成了文档上的所有步骤,但是我没有得到任何东西。如果打印(get_defined_vars())没有显示任何东西…:( 我的控制器 function index() { $this->load->helper('form'); $this->load->helper('captcha'); $this->load->model('captcha'); $vals = array(
function index()
{
$this->load->helper('form');
$this->load->helper('captcha');
$this->load->model('captcha');
$vals = array(
'word' => 'Random word',
'img_path' => '../images/captcha/',
'img_url' => 'http://mysite/images/captcha/',
'font' => '../../system/fonts/texb.ttf',
'img_width' => '150',
'img_height' => 30,
'expiration' => 7200,
"time" => time()
);
$data['cap'] = create_captcha($vals);
$cap = array(
'captcha_time' => $vals['time'],
'ip_address' => $this->input->ip_address(),
'word' => $vals['word']
);
$this->captcha_model->insert_captcha($cap);
//print_r(get_defined_vars());
$data['main_content'] = 'admin/landing.php';
$this->load->view('includes/template', $data);
}
我的模型
函数输入\验证码($data)
{
$query=$this->db->insert_字符串('captcha',$data);
$this->db->query($query);
}
我的看法
在你死亡之前,你必须验证这个验证码!
你是谁
问题出在图像的路径中。有一件事,即使日志阈值设置为4,我也没有发现任何问题。我将其设置为绝对路径,一切正常
您的模型正在加载吗?按照加载方式,您的模型名称似乎不是以首字母大写开头的?它应该说明:$this->load->model('Captcha');
function input_captcha($data)
{
$query = $this->db->insert_string('captcha', $data);
$this->db->query($query);
}
<section>
<h3>You must captcha this captcha before proceeding to your demise!</h3>
<article>
<?php echo form_open('admin/auth');?>
<p>Who the F are you?</p>
<?php echo form_input('email', 'your real email!');?>
<br>
<?php echo 'Submit the word you see below:';?>
<br>
<?php echo $cap['image'];?>
<br>
<?php echo '<input type="text" name="captcha" value="" />'; ?>
<br>
<?php echo form_submit('submit', 'Send It!');?>
<?php echo form_close();?>
</article>
</section>
function index()
{
$this->load->helper('form');
$this->load->helper('captcha');
$this->load->model('captcha_model');
$vals = array(
'img_path' => '/var/www/mysite.com/images/captcha/',
'img_url' => 'http://mysite.com/images/captcha/',
'font' => '../../system/fonts/texb.ttf',
'img_width' => '150',
'img_height' => 30,
'expiration' => 7200,
"time" => time()
);
$data['cap'] = create_captcha($vals);
$cap = array(
'captcha_time' => $data['cap']['time'],
'ip_address' => $this->input->ip_address(),
'word' => $data['cap']['word']
);
$this->captcha_model->add_captcha($cap);
$data['main_content'] = 'admin/landing.php';
$this->load->view('includes/template', $data);
}