这个生成验证码功能的图像路径和图像网址是什么?

时间:2015-10-20 05:02:51

标签: codeigniter codeigniter-2 codeigniter-3 simplecaptcha

我正在尝试找到img_path和img_url,如下面的控制器函数所示。那就是生成验证码。有谁知道在下面的控制器函数中给出的img_path和img_url是什么?

控制器

 function generateCaptcha() {

            //Load Captcha helper
            $this->load->helper('captcha');

                $vals = array(
                    'word'       => 'Security Key words',
                    'img_path'   => './uploads/captcha/',
                    'img_url'    => base_url() . 'captcha/',
                    'img_width'  => 200,
                    'img_height' => 50,
                    'expiration' => 7200,
                );

                /* Generate the captcha */
                $captcha = create_captcha($vals);

                /* Store the captcha value (or 'word') in a session to retrieve later */
                $this->session->set_userdata('captchaWord', $captcha['word']);
                $this->session->set_userdata('captchaImage', $captcha['image']);

                return $captcha['image'];
            }

1 个答案:

答案 0 :(得分:1)

下面

img_path 是captach文件夹的绝对路径

img_url 是captach图片的相对路径

$vals = array(
    'word'       => 'Security Key words',
    'img_path'   => './uploads/captcha/',
    'img_url'    => base_url() . 'uploads/captcha/',
    'img_width'  => 200,
    'img_height' => 50,
    'expiration' => 7200,
);