The s2component function performs registration of a component. The s2component function registers a component using the register method of S2ApplicationContext class.
<?php require_once('S2Container.php'); class Action {} s2component('Action'); // same as s2register('Action'); $action = s2get('Action'); var_dump($action);
When specifying a component name, it specifies by the ComponentInfoDef instance which is a return value of the s2component function.
<?php require_once('S2Container.php'); class Action {} s2component('Action')->setName('act'); $action = s2get('act'); var_dump($action);
![]() | NOTE |
---|---|
This Example is located at "examples/quickstart/quickstart010.php". |
© Copyright The Seasar Foundation and the others 2005-2010, all rights reserved. |