2012-07-30 46 views
2

我使用了captcha组件和cakephp 2.0。虽然它进展顺利,但我跟踪这个组件的问题。Cakephp 2.0验证码组件给出了警告

Warning: Argument 1 passed to Component::__construct() must be an instance of ComponentCollection, none given, called in ... 

当我试图找到解决它给了我在某处评论双线代码。

_controller = $collection->getController(); 
parent::__construct($collection, $settings); 

function startup() { 
    $this->Controller = $this->_controller; 
} 

该解决方案的代码是这样的事情结束了我的错误。

验证码分量链路是http://www.devarticles.in/

回答

6

我发现该溶液CakePHP的2.0。在控制器在其中创建实例做这样的..

$myvideo = new MyVideoComponent(new ComponentCollection()); //make instance