我使用驗證碼組件從http://www.devarticles.in/驗證碼組件讀會話錯誤
我已經進口的驗證碼組件像
App::import('Component', 'Captcha'); //load it
$this->Captcha = new CaptchaComponent(new ComponentCollection()); //make instance
$this->Captcha->startup($this);
但是當我嘗試調用功能
$captcha = $this->Captcha->getVerCode();
它給我錯誤爲
Call to a member function read() on a non-object in C:\xampp\htdocs\westudy_old\app\Controller\Component\CaptchaComponent.php on line 65
我的組件的功能組件的
function getVerCode() {
return $this->Controller->Session->read('security_code');
}
和啓動功能
function startup() {
$this->Controller = $this->_controller;
}