打印 Yii::createWebApplication($config) [ 新手入门 ]
我在入口文件中想打印出Yii初始化都干了些什么事,结果中有一项["_moduleConfig":"CModule":private]=>
的值始终不明白是什么时候被赋值的??,请各位朋友帮忙解答一下哦!~~其值为:
array(8) {
["active"]=>
array(1) {
["class"]=>
string(19) "active.ActiveModule"
}
["card"]=>
array(1) {
["class"]=>
string(15) "card.CardModule"
}
["game"]=>
array(1) {
["class"]=>
string(15) "game.GameModule"
}
["monitor"]=>
array(1) {
["class"]=>
string(21) "monitor.MonitorModule"
}
["sqladmin"]=>
array(3) {
["gamedbs"]=>
array(4) {
[1000]=>
array(2) {
["fnaccount"]=>
string(9) "FNAccount"
["fnmember"]=>
string(8) "FNMember"
}
[1001]=>
array(9) {
["fnaccount"]=>
string(9) "FNAccount"
["fnmember"]=>
string(8) "FNMember"
["fndb1"]=>
string(5) "FNDB1"
["fndb2"]=>
string(5) "FNDB2"
["fndb3"]=>
string(5) "FNDB3"
["fndb4"]=>
string(5) "FNDB4"
["fndb5"]=>
string(5) "FNDB5"
["fndb6"]=>
string(5) "FNDB6"
["fndb7"]=>
string(5) "FNDB7"
}
[1002]=>
array(6) {
["fnaccount"]=>
string(9) "FNAccount"
["fnmember"]=>
string(8) "FNMember"
["fndb1"]=>
string(5) "FNDB1"
["fndb2"]=>
string(5) "FNDB2"
["fndb3"]=>
string(5) "FNDB3"
["fndb4"]=>
string(5) "FNDB4"
}
[1003]=>
array(6) {
["fnaccount"]=>
string(9) "FNAccount"
["fnmember"]=>
string(8) "FNMember"
["fndb1"]=>
string(5) "FNDB1"
["fndb2"]=>
string(5) "FNDB2"
["fndb3"]=>
string(5) "FNDB3"
["fndb4"]=>
string(5) "FNDB4"
}
}
["limitPerPage"]=>
int(20)
["class"]=>
string(23) "sqladmin.SqladminModule"
}
["admin"]=>
array(1) {
["class"]=>
string(17) "admin.AdminModule"
}
["srbac"]=>
array(20) {
["userclass"]=>
string(4) "User"
["userid"]=>
string(6) "userid"
["username"]=>
string(8) "username"
["delimeter"]=>
string(1) "@"
["debug"]=>
bool(true)
["pageSize"]=>
string(2) "50"
["superUser"]=>
string(13) "Administrator"
["css"]=>
string(9) "srbac.css"
["layout"]=>
string(30) "application.views.layouts.main"
["alwaysAllowed"]=>
array(4) {
[0]=>
string(9) "SiteIndex"
[1]=>
string(9) "SiteError"
[2]=>
string(18) "admin_ProfileLogin"
[3]=>
string(19) "admin_ProfileLogout"
}
["userActions"]=>
array(3) {
[0]=>
string(4) "Show"
[1]=>
string(4) "View"
[2]=>
string(4) "List"
}
["listBoxNumberOfLines"]=>
int(15)
["imagesPack"]=>
string(4) "noia"
["iconText"]=>
bool(true)
["header"]=>
string(27) "srbac.views.authitem.header"
["footer"]=>
string(27) "srbac.views.authitem.footer"
["showHeader"]=>
bool(true)
["showFooter"]=>
bool(true)
["alwaysAllowedPath"]=>
string(16) "srbac.components"
["class"]=>
string(17) "srbac.SrbacModule"
}
["gii"]=>
array(3) {
["class"]=>
string(20) "system.gii.GiiModule"
["password"]=>
string(6) "123456"
["ipFilters"]=>
array(3) {
[0]=>
string(9) "127.0.0.1"
[1]=>
string(3) "::1"
[2]=>
string(13) "192.168.234.1"
}
}
}
配置文件:main.php里的配置如下:
return array(
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'客户端运营中心管理系统',
'timeZone'=>'Asia/Chongqing',
'language'=>'zh_cn',
// preloading 'log' component
'preload'=>array('log'),
'modules'=>array(
'active'=>array(),
'card'=>array(),
'game'=>array(),
'monitor'=>array(),
'sqladmin'=>array(
'gamedbs'=>array(
'1000'=>array('fnaccount'=>'FNAccount','fnmember'=>'FNMember','fndb'=>'FNDB'),
'1001'=>array('fnaccount'=>'FNAccount','fnmember'=>'FNMember','fndb1'=>'FNDB1','fndb2'=>'FNDB2','fndb3'=>'FNDB3','fndb4'=>'FNDB4','fndb5'=>'FNDB5','fndb6'=>'FNDB6','fndb7'=>'FNDB7'),
'1002'=>array('fnaccount'=>'FNAccount','fnmember'=>'FNMember','fndb1'=>'FNDB1','fndb2'=>'FNDB2','fndb3'=>'FNDB3','fndb4'=>'FNDB4'),
'1003'=>array('fnaccount'=>'FNAccount','fnmember'=>'FNMember','fndb1'=>'FNDB1','fndb2'=>'FNDB2','fndb3'=>'FNDB3','fndb4'=>'FNDB4'),
),
'limitPerPage'=>20,
),
'admin'=>array(),
'srbac'=>array(
'userclass'=>'User',
'userid'=>'userid',
'username'=>'username',
'delimeter'=>'@',
'debug'=>TRUE,
'pageSize'=>'50',
'superUser'=>'Administrator',
'css'=>'srbac.css',
'layout'=>'application.views.layouts.main',
//'notAuthorizedView'=>'srabc.views.authitem.unauthorized',
'alwaysAllowed'=>array('SiteIndex','SiteError','admin_ProfileLogin','admin_ProfileLogout'),
'userActions'=>array('Show','View','List'),
'listBoxNumberOfLines'=>15,
//'imagesPath'=>'srabc.images',
'imagesPack'=>'noia',
'iconText'=>true,
'header'=>'srbac.views.authitem.header',
'footer'=>'srbac.views.authitem.footer',
'showHeader'=>true,
'showFooter'=>true,
'alwaysAllowedPath'=>'srbac.components',
),
// uncomment the following to enable the Gii tool
'gii'=>array(
'class'=>'system.gii.GiiModule',
'password'=>'123456',
// If removed, Gii defaults to localhost only. Edit carefully to taste.
'ipFilters'=>array('127.0.0.1','::1','192.168.234.1'),
),
),
// application components
'components'=>array(
'authManager'=>array(
'class'=>'application.modules.srbac.components.SDbAuthManager',//认证类名称
'connectionID'=>'db_legend',
//'defaultRoles'=>array('guest'),//默认角色
'itemTable' => 'quick_auth_item',//认证项表名称
'itemChildTable' => 'quick_auth_item_child',//认证项父子关系
'assignmentTable' => 'quick_auth_assignment',//认证项赋权关系
),
'user'=>array(
// enable cookie-based authentication
'allowAutoLogin'=>false,
'loginUrl' => array('/admin/profile/login'),
),
// uncomment the following to enable URLs in path-format
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>false,
'urlSuffix'=>'.html',
'rules'=>array(
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
'errorHandler'=>array(
// use 'site/error' action to display errors
'errorAction'=>'site/error',
),
'log'=>array(
'class'=>'CLogRouter',
'routes'=>array(
array(
'class'=>'CFileLogRoute',
'levels'=>'error, warning',
),
// uncomment the following to show log messages on web pages
/*
array(
'class'=>'CWebLogRoute',
),
array(
'class' => 'CWebLogRoute',
'levels' => 'profile,trace',
),
array(
'class' => 'CProfileLogRoute',
'levels' => 'profile',
),
*/
),
),
),
'aliases'=>array(
'quick'=>'/data/app/www/quick2/',
),
// application-level parameters that can be accessed
// using Yii::app()->params['paramName']
'params'=>array(
// this is used in contact page
'adminEmail'=>'webmaster@example.com',
'hashSalt'=>'1kl23.3.0ds44lllaasl'
),
);
共 1 条回复
-
终于弄明白了,原来在
CApplication
的构造函数中运行$this->configure
时,$this->$keky = $value
,如果此类的属性中没有$key属性的话,程序就会走到CComponent类的__set
方法中,进而会调用setmodules
方法,在CModule
类中有setModules
方法存在,但是setModules
方法名中的Modules
是大写开头,所以调用不了setModules
方法啊,可是在CComponent
类的__set
方法中是用method_exists
方法判断setmodules
是否存在的,所以大小写是没有关系的,所以会走到setModules
方法,在这个方法中就有对__moduleConfig
进行赋值操作的 ^ ^ ^ ^
YiiHoney 昆仑万维
注册时间:2011-09-23
最后登录:1970-01-01
在线时长:0小时0分
最后登录:1970-01-01
在线时长:0小时0分
- 粉丝0
- 金钱275
- 威望0
- 积分275