PHP 클래스 yii\base\Application

For more details and usage information on Application, see the guide article on applications.
부터: 2.0
저자: Qiang Xue ([email protected])
상속: extends Module
파일 보기 프로젝트 열기: yiisoft/yii2 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$bootstrap list of components that should be run during the application [[bootstrap()|bootstrapping process]]. Each component may be specified in one of the following formats: - an application component ID as specified via [[components]]. - a module ID as specified via [[modules]]. - a class name. - a configuration array. During the bootstrapping process, each component will be instantiated. If the component class implements BootstrapInterface, its [[BootstrapInterface::bootstrap()|bootstrap()]] method will be also be called.
$charset the charset currently used for the application.
$controller the currently active controller instance
$controllerNamespace the namespace that controller classes are located in. This namespace will be used to load controller classes by prepending it to the controller class name. The default namespace is app\controllers. Please refer to the guide about class autoloading for more details.
$extensions list of installed Yii extensions. Each array element represents a single extension with the following structure: php [ 'name' => 'extension name', 'version' => 'version number', 'bootstrap' => 'BootstrapClassName', // optional, may also be a configuration array 'alias' => [ '@alias1' => 'to/path1', '@alias2' => 'to/path2', ], ] The "bootstrap" class listed above will be instantiated during the application [[bootstrap()|bootstrapping process]]. If the class implements BootstrapInterface, its [[BootstrapInterface::bootstrap()|bootstrap()]] method will be also be called. If not set explicitly in the application config, this property will be populated with the contents of @vendor/yiisoft/extensions.php.
$language the language that is meant to be used for end users. It is recommended that you use IETF language tags. For example, en stands for English, while en-US stands for English (United States).
$layout the layout that should be applied for views in this application. Defaults to 'main'. If this is false, layout will be disabled.
$loadedModules list of loaded modules indexed by their class names.
$name the application name.
$requestedAction the requested Action. If null, it means the request cannot be resolved into an action.
$requestedParams the parameters supplied to the requested action.
$requestedRoute the requested route
$sourceLanguage the language that the application is written in. This mainly refers to the language that the messages and view files are written in.
$state the current application state during a request handling life cycle. This property is managed by the application. Do not modify this property.

공개 메소드들

메소드 설명
__construct ( array $config = [] ) Constructor.
coreComponents ( ) Returns the configuration of core application components.
end ( integer $status, Response $response = null ) Terminates the application.
getAssetManager ( ) : AssetManager Returns the asset manager.
getAuthManager ( ) : yii\rbac\ManagerInterface Returns the auth manager for this application.
getCache ( ) : Cache Returns the cache component.
getDb ( ) : Connection Returns the database connection component.
getErrorHandler ( ) : ErrorHandler | yii\console\ErrorHandler Returns the error handler component.
getFormatter ( ) : Formatter Returns the formatter component.
getI18n ( ) : yii\i18n\I18N Returns the internationalization (i18n) component
getLog ( ) : Dispatcher Returns the log dispatcher component.
getMailer ( ) : yii\mail\MailerInterface Returns the mailer component.
getRequest ( ) : Request | yii\console\Request Returns the request component.
getResponse ( ) : Response | yii\console\Response Returns the response component.
getRuntimePath ( ) : string Returns the directory that stores runtime files.
getSecurity ( ) : Security Returns the security component.
getTimeZone ( ) : string Returns the time zone used by this application.
getUniqueId ( ) : string Returns an ID that uniquely identifies this module among all modules within the current application.
getUrlManager ( ) : UrlManager Returns the URL manager for this application.
getVendorPath ( ) : string Returns the directory that stores vendor files.
getView ( ) : View | View Returns the view object.
handleRequest ( Request $request ) : Response Handles the specified request.
init ( )
preInit ( array &$config ) Pre-initializes the application.
run ( ) : integer Runs the application.
setBasePath ( string $path ) Sets the root directory of the application and the @app alias.
setContainer ( array $config ) Configures [[Yii::$container]] with the $config
setRuntimePath ( string $path ) Sets the directory that stores runtime files.
setTimeZone ( string $value ) Sets the time zone used by this application.
setVendorPath ( string $path ) Sets the directory that stores vendor files.

보호된 메소드들

메소드 설명
bootstrap ( ) Initializes extensions and executes bootstrap components.
registerErrorHandler ( array &$config ) Registers the errorHandler component as a PHP error handler.

메소드 상세

__construct() 공개 메소드

Constructor.
public __construct ( array $config = [] )
$config array name-value pairs that will be used to initialize the object properties. Note that the configuration must contain both [[id]] and [[basePath]].

bootstrap() 보호된 메소드

This method is called by Application::init after the application has been fully configured. If you override this method, make sure you also call the parent implementation.
protected bootstrap ( )

coreComponents() 공개 메소드

Returns the configuration of core application components.
또한 보기: set()
public coreComponents ( )

end() 공개 메소드

This method replaces the exit() function by ensuring the application life cycle is completed before terminating the application.
public end ( integer $status, Response $response = null )
$status integer the exit status (value 0 means normal exit while other values mean abnormal exit).
$response Response the response to be sent. If not set, the default application [[response]] component will be used.

getAssetManager() 공개 메소드

Returns the asset manager.
public getAssetManager ( ) : AssetManager
리턴 yii\web\AssetManager the asset manager application component.

getAuthManager() 공개 메소드

Returns the auth manager for this application.
public getAuthManager ( ) : yii\rbac\ManagerInterface
리턴 yii\rbac\ManagerInterface the auth manager application component. Null is returned if auth manager is not configured.

getCache() 공개 메소드

Returns the cache component.
public getCache ( ) : Cache
리턴 yii\caching\Cache the cache application component. Null if the component is not enabled.

getDb() 공개 메소드

Returns the database connection component.
public getDb ( ) : Connection
리턴 yii\db\Connection the database connection.

getErrorHandler() 공개 메소드

Returns the error handler component.
public getErrorHandler ( ) : ErrorHandler | yii\console\ErrorHandler
리턴 yii\web\ErrorHandler | yii\console\ErrorHandler the error handler application component.

getFormatter() 공개 메소드

Returns the formatter component.
public getFormatter ( ) : Formatter
리턴 yii\i18n\Formatter the formatter application component.

getI18n() 공개 메소드

Returns the internationalization (i18n) component
public getI18n ( ) : yii\i18n\I18N
리턴 yii\i18n\I18N the internationalization application component.

getLog() 공개 메소드

Returns the log dispatcher component.
public getLog ( ) : Dispatcher
리턴 yii\log\Dispatcher the log dispatcher application component.

getMailer() 공개 메소드

Returns the mailer component.
public getMailer ( ) : yii\mail\MailerInterface
리턴 yii\mail\MailerInterface the mailer application component.

getRequest() 공개 메소드

Returns the request component.
public getRequest ( ) : Request | yii\console\Request
리턴 yii\web\Request | yii\console\Request the request component.

getResponse() 공개 메소드

Returns the response component.
public getResponse ( ) : Response | yii\console\Response
리턴 yii\web\Response | yii\console\Response the response component.

getRuntimePath() 공개 메소드

Returns the directory that stores runtime files.
public getRuntimePath ( ) : string
리턴 string the directory that stores runtime files. Defaults to the "runtime" subdirectory under [[basePath]].

getSecurity() 공개 메소드

Returns the security component.
public getSecurity ( ) : Security
리턴 Security the security application component.

getTimeZone() 공개 메소드

This is a simple wrapper of PHP function date_default_timezone_get(). If time zone is not configured in php.ini or application config, it will be set to UTC by default.
또한 보기: http://php.net/manual/en/function.date-default-timezone-get.php
public getTimeZone ( ) : string
리턴 string the time zone used by this application.

getUniqueId() 공개 메소드

Since this is an application instance, it will always return an empty string.
public getUniqueId ( ) : string
리턴 string the unique ID of the module.

getUrlManager() 공개 메소드

Returns the URL manager for this application.
public getUrlManager ( ) : UrlManager
리턴 yii\web\UrlManager the URL manager for this application.

getVendorPath() 공개 메소드

Returns the directory that stores vendor files.
public getVendorPath ( ) : string
리턴 string the directory that stores vendor files. Defaults to "vendor" directory under [[basePath]].

getView() 공개 메소드

Returns the view object.
public getView ( ) : View | View
리턴 View | View the view application component that is used to render various view files.

handleRequest() 추상적인 공개 메소드

This method should return an instance of Response or its child class which represents the handling result of the request.
abstract public handleRequest ( Request $request ) : Response
$request Request the request to be handled
리턴 Response the resulting response

init() 공개 메소드

public init ( )

preInit() 공개 메소드

This method is called at the beginning of the application constructor. It initializes several important application properties. If you override this method, please make sure you call the parent implementation.
public preInit ( array &$config )
$config array the application configuration

registerErrorHandler() 보호된 메소드

Registers the errorHandler component as a PHP error handler.
protected registerErrorHandler ( array &$config )
$config array application config

run() 공개 메소드

This is the main entrance of an application.
public run ( ) : integer
리턴 integer the exit status (0 means normal, non-zero values mean abnormal)

setBasePath() 공개 메소드

This method can only be invoked at the beginning of the constructor.
public setBasePath ( string $path )
$path string the root directory of the application.

setContainer() 공개 메소드

Configures [[Yii::$container]] with the $config
부터: 2.0.11
public setContainer ( array $config )
$config array values given in terms of name-value pairs

setRuntimePath() 공개 메소드

Sets the directory that stores runtime files.
public setRuntimePath ( string $path )
$path string the directory that stores runtime files.

setTimeZone() 공개 메소드

This is a simple wrapper of PHP function date_default_timezone_set(). Refer to the php manual for available timezones.
또한 보기: http://php.net/manual/en/function.date-default-timezone-set.php
public setTimeZone ( string $value )
$value string the time zone used by this application.

setVendorPath() 공개 메소드

Sets the directory that stores vendor files.
public setVendorPath ( string $path )
$path string the directory that stores vendor files.

프로퍼티 상세

$bootstrap 공개적으로 프로퍼티

list of components that should be run during the application [[bootstrap()|bootstrapping process]]. Each component may be specified in one of the following formats: - an application component ID as specified via [[components]]. - a module ID as specified via [[modules]]. - a class name. - a configuration array. During the bootstrapping process, each component will be instantiated. If the component class implements BootstrapInterface, its [[BootstrapInterface::bootstrap()|bootstrap()]] method will be also be called.
public $bootstrap

$charset 공개적으로 프로퍼티

the charset currently used for the application.
public $charset

$controller 공개적으로 프로퍼티

the currently active controller instance
public $controller

$controllerNamespace 공개적으로 프로퍼티

the namespace that controller classes are located in. This namespace will be used to load controller classes by prepending it to the controller class name. The default namespace is app\controllers. Please refer to the guide about class autoloading for more details.
public $controllerNamespace

$extensions 공개적으로 프로퍼티

list of installed Yii extensions. Each array element represents a single extension with the following structure: php [ 'name' => 'extension name', 'version' => 'version number', 'bootstrap' => 'BootstrapClassName', // optional, may also be a configuration array 'alias' => [ '@alias1' => 'to/path1', '@alias2' => 'to/path2', ], ] The "bootstrap" class listed above will be instantiated during the application [[bootstrap()|bootstrapping process]]. If the class implements BootstrapInterface, its [[BootstrapInterface::bootstrap()|bootstrap()]] method will be also be called. If not set explicitly in the application config, this property will be populated with the contents of @vendor/yiisoft/extensions.php.
public $extensions

$language 공개적으로 프로퍼티

the language that is meant to be used for end users. It is recommended that you use IETF language tags. For example, en stands for English, while en-US stands for English (United States).
또한 보기: sourceLanguage
public $language

$layout 공개적으로 프로퍼티

the layout that should be applied for views in this application. Defaults to 'main'. If this is false, layout will be disabled.
public $layout

$loadedModules 공개적으로 프로퍼티

list of loaded modules indexed by their class names.
public $loadedModules

$name 공개적으로 프로퍼티

the application name.
public $name

$requestedAction 공개적으로 프로퍼티

the requested Action. If null, it means the request cannot be resolved into an action.
public $requestedAction

$requestedParams 공개적으로 프로퍼티

the parameters supplied to the requested action.
public $requestedParams

$requestedRoute 공개적으로 프로퍼티

the requested route
public $requestedRoute

$sourceLanguage 공개적으로 프로퍼티

the language that the application is written in. This mainly refers to the language that the messages and view files are written in.
또한 보기: language
public $sourceLanguage

$state 공개적으로 프로퍼티

the current application state during a request handling life cycle. This property is managed by the application. Do not modify this property.
public $state