【发布时间】:2016-01-31 16:03:34
【问题描述】:
控制器中的验证码功能:
public function captcha(){
$this->load->helper('captcha');
$captcha = array(
'word' => 'Random 123',
'img_path' => './captcha/',
'image_url' => base_url() . 'captcha/',
'font_path' => './fonts/LucidaTypewriterBold.ttf',
'img_width' => '300',
'img_height' => '50',
'expiration' => '3600',
);
$img = create_captcha($captcha);
$dataf['image'] = $img['image'];
$this->load->view('captcha_view', $dataf);
}
验证码查看文件:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Enter Captcha</title>
</head>
<body>
<h3>Creating CAPTCHA</h3>
<?php
echo $image;
// echo '<br/>Word: ' .$word;
// echo '<br/>time: ' .$time;
?>
</body>
</html>
这不会加载验证码图像,只会加载标题“正在创建验证码”。此外,没有显示错误。
我是 php/codeigniter 的新手,请帮忙。
【问题讨论】:
-
能否打印验证码数组??
-
请检查您对验证码文件夹的权限。它应该是 666 或 777 。
-
数组 ( [word] => 随机 123 [img_path] => ./captcha/ [image_url] => localhost/fapogee/captcha [font_path] => ./fonts/LucidaTypewriterBold.ttf [img_width] = > 300 [img_height] => 50 [过期] => 3600)
-
@Drudge 我更改了权限,但问题仍然存在!
标签: php codeigniter