2011-02-26 80 views

回答

5

Bootstrap.php中_init方法的每個返回值都被視爲資源,並因此保存在引導程序的Zend_Registry容器中。對於`getContainer()

$theTestResource = $this->getInvokeArg('bootstrap')->getResource('test'); 

// OR you can also do the same as 

$theTestResource = $this->getInvokeArg('bootstrap')->getContainer()->test; 
+0

+1 - > test'變種:因此,你可以做例如爲:

// in Bootstrap.php protected function _initTest() { return 'some return value'; } 

,並在控制器一些行動。我不知道那個。男人,馬辛,你是在聲名狼借。 ;-) – 2011-02-26 16:53:12

+0

也可以做Zend_Controller_Front :: getInstance() - > getParam('bootstrap') - > getResource('test'); – 2011-02-26 19:29:51

+0

@David Weinraub。謝謝大衛。對於上個星期我有很多空閒時間,我花了一些時間在SO :-) – Marcin 2011-02-27 04:44:09

相關問題