2
我想知道如何(如果可能)訪問Zend Framework應用程序的Bootstrap.php文件中_init方法的返回值?在Zend Framework應用程序中從Bootstrap.php獲取返回值
我想知道如何(如果可能)訪問Zend Framework應用程序的Bootstrap.php文件中_init方法的返回值?在Zend Framework應用程序中從Bootstrap.php獲取返回值
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;
+1 - > test'變種:因此,你可以做例如爲:
,並在控制器一些行動。我不知道那個。男人,馬辛,你是在聲名狼借。 ;-) – 2011-02-26 16:53:12
也可以做Zend_Controller_Front :: getInstance() - > getParam('bootstrap') - > getResource('test'); – 2011-02-26 19:29:51
@David Weinraub。謝謝大衛。對於上個星期我有很多空閒時間,我花了一些時間在SO :-) – Marcin 2011-02-27 04:44:09