【发布时间】:2023-11-10 17:10:02
【问题描述】:
我的 gd2 图像库有问题 这是我的索引控制器
public function index()
{
$config['image_library'] = 'gd2';
$this->load->library('image_lib', $config);
$vals = array(
'img_path' => './captcha/',
'img_url' => base_url().'public/img/captcha/',
'img_width' => '200',
'img_height' => 30,
'border' => 0,
'expiration' => 7200,
);
// create captcha image
$cap = create_captcha($vals);
print_r($cap);
// store image html code in a variable
$arrData['image'] = $cap['image'];
// store the captcha word in a session
$this->session->set_userdata('word', $cap['word']);
$arrData['middle'] = 'contact';
$this->load->view('template',$arrData);
}
上面这段代码是我的控制器的索引函数
这是我的看法
<div class="enquiry-deatils">
<label>Type character * :</label>
<input type="text" placeholder="" class="captcha"/>
<label><img src="images/capcha.jpg" /></label>
<?php echo $image; // this will show the captcha image ?>
</div>
我不知道是什么错误,它什么也没显示
【问题讨论】:
-
你检查过萤火虫中的图像元素吗?
-
是的,它显示空白没有图像标签
-
然后执行 print_r($arrData);在传递给视图之前在控制器中。
-
这是给我看这个输出数组([image] => [middle] => contact)
标签: php codeigniter captcha recaptcha