驗證碼功能:笨 - 驗證碼助手不在控制器工作
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>
這不加載驗證碼圖像,只有標題 '創建CAPTCHA'。此外,沒有顯示錯誤。
我是php/codeigniter的新手,請大家幫忙。
您能打印驗證碼數組嗎? – santosh
請檢查您對captcha文件夾的許可。它應該是666或777。 – Drudge
Array([word] => Random 123 [img_path] => ./captcha/ [image_url] => http:// localhost/fapogee/captcha/[font_path] => ./fonts/LucidaTypewriterBold.ttf [img_width] = > 300 [img_height] => 50 [expiration] => 3600) –