我正在使用来自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;
}