How can I access the configuration of a Zend Framework application from a controller?

前端 未结 7 1626
忘掉有多难
忘掉有多难 2021-01-30 14:18

I have a Zend Framework application based on the quick-start setup.

I\'ve gotten the demos working and am now at the point of instantiating a new model class to do some

7条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-30 14:49

    A really simple way to access the configuration options is by directly accessing the globally defined $application variable.

    class My_UserController extends Zend_Controller_Action {
        public function indexAction() {
            global $application;
            $options = $application->getOptions();
        }
    }
    

提交回复
热议问题