2009-12-13 112 views
0

當我在引導程序中執行_init*()函數返回時,它實際上做了什麼?這樣我就可以不說:Zend Framework引導問題

$x = $this->bootstrap('something'); 

哦,或者是它讓我可以做一個$this->getResource('something')。如果我不做回報,我以後得不到資源?

另外,當我做一個$x = $this->bootstrap('something');我想那會在bootstrap()之前自動運行?那是什麼時候?

當我做$x = $application->getOption('something');我從配置中獲取'something'數組?我需要先做一個$application->getBootstrap()->bootstrap('something')嗎?

回答

2

$ x = $ this-> getResource('something'); 其用於初始化和檢索「東西」的資源,所以你可以在這裏應用

$x = $this->bootstrap('something'); 

其他使用該資源用於自舉像數據庫,視圖...等 的「東西」在資源換句話說[以確保一些資源被初始化]

$x = $application->getOption('something'); 

被用來讀取「東西」資源 的配置文件應該像

resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" 
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts" 

強烈建議你檢查quick start