我正在阅读扩展文件,并参见以下代码:
if ($job && $job['cruser_id'] != $GLOBALS['TSFE']->fe_user->user['uid'])
我发现$GLOBALS['TSFE']->fe_user
是类的对象:tslib_feuserauth
,我检查了文件:class.tslib_feuserauth.php
,
我的问题是:
什么是user['uid']
? user
是一个数组,但在class.tslib_feuserauth.php
中没有看到如下代码:$this->user['uid']
答案 0 :(得分:1)
如果用户是logged
,则此数组表示来自DB的用户行,并且只包含fe_users
表的所有列,否则为FALSE
,因此您可以使用它来确定登录状态:< / p>
if ($GLOBALS['TSFE']->fe_user->user){
$msg = 'You are logged as ' . $GLOBALS['TSFE']->fe_user->user['username'];
} else {
$msg = 'You need to login first';
}