Kev*_*vin 2 php zend-framework
我想知道如何(如果可能的话)在Zend Framework应用程序的Bootstrap.php文件中访问_init方法的返回值?
Bootstrap.php中_init方法的每个返回值都作为资源进行威胁,因此保存在引导程序的Zend_Registry容器中.因此你可以这样做:
// in Bootstrap.php
protected function _initTest() {
return 'some return value';
}
Run Code Online (Sandbox Code Playgroud)
在控制器的某些动作中:
$theTestResource = $this->getInvokeArg('bootstrap')->getResource('test');
// OR you can also do the same as
$theTestResource = $this->getInvokeArg('bootstrap')->getContainer()->test;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
455 次 |
| 最近记录: |