2012-07-30 45 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