2015-10-20 50 views
0

我試圖找到img_path和img_url在下面的控制器功能中給出。這是生成驗證碼。有人知道下面的控制器函數中給出的img_path和img_url是什麼?什麼是圖像路徑和圖像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

這裏

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, 
); 
的相對路徑