💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# Class Phalcon\\Mvc\\Application # Class **Phalcon\\Mvc\\Application** *extends* abstract class `Phalcon\Di\Injectable` *implements*[*Phalcon\\Events\\EventsAwareInterface*](#), `Phalcon\Di\InjectionAwareInterface` This component encapsulates all the complex operations behind instantiating every component needed and integrating it with the rest to allow the MVC pattern to operate as desired. ``` <pre class="calibre14">``` <?php class Application extends \Phalcon\Mvc\Application { /** * Register the services here to make them general or register * in the ModuleDefinition to make them module-specific */ protected function _registerServices() { } /** * This method registers all the modules in the application */ public function main() { $this->registerModules(array( 'frontend' => array( 'className' => 'Multiple\Frontend\Module', 'path' => '../apps/frontend/Module.php' ), 'backend' => array( 'className' => 'Multiple\Backend\Module', 'path' => '../apps/backend/Module.php' ) )); } } $application = new Application(); $application->main(); ``` ``` ### Methods public **\_\_construct** (\[*unknown* $dependencyInjector\]) public **useImplicitView** (*unknown* $implicitView) By default. The view is implicitly buffering all the output You can full disable the view component using this method public **registerModules** (*unknown* $modules, \[*unknown* $merge\]) Register an array of modules present in the application ``` <pre class="calibre14">``` <?php $this->registerModules(array( 'frontend' => array( 'className' => 'Multiple\Frontend\Module', 'path' => '../apps/frontend/Module.php' ), 'backend' => array( 'className' => 'Multiple\Backend\Module', 'path' => '../apps/backend/Module.php' ) )); ``` ``` public *array***getModules** () Return the modules registered in the application public *array|object***getModule** (*string* $name) Gets the module definition registered in the application via module name public **setDefaultModule** (*unknown* $defaultModule) Sets the module name to be used if the router doesn't return a valid module public **getDefaultModule** () Returns the default module name public [*Phalcon\\Http\\ResponseInterface*](#)[|](#)boolean **handle** (\[*string* $uri\]) Handles a MVC request public **setDI** (*unknown* $dependencyInjector) inherited from Phalcon\\Di\\Injectable Sets the dependency injector public **getDI** () inherited from Phalcon\\Di\\Injectable Returns the internal dependency injector public **setEventsManager** (*unknown* $eventsManager) inherited from Phalcon\\Di\\Injectable Sets the event manager public **getEventsManager** () inherited from Phalcon\\Di\\Injectable Returns the internal event manager public **\_\_get** (*unknown* $propertyName) inherited from Phalcon\\Di\\Injectable Magic method \_\_get | - [索引](# "总目录") - [下一页](# "Class Phalcon\Mvc\Application\Exception") | - [上一页](# "Class Phalcon\Logger\Multiple") | - [API Indice](#) »