簡體   English   中英

Codeigniter-驗證碼助手不起作用

[英]codeigniter - captcha helper not working

控制器中的驗證碼功能:

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>

這不會加載驗證碼圖片,只會加載標題“ Creating CAPTCHA”。 此外,沒有顯示錯誤。

我是php / codeigniter的新手,請幫忙。

嘗試這個

加載驗證碼應該是這樣的

$captcha_array = array(
    'name' => 'captcha',
    'class' => 'input_box',
    'color' => 'white',
    'placeholder' => '',
    'id' => 'captcha'
);
echo form_input($captcha_array);

而且您的控制器代碼也應該更改。 您也需要會話幫助

也檢查本教程

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM