如何在concrete5 userinfo模式下将单个值与userinfo对象分开

时间:2013-11-20 11:35:29

标签: php concrete5

我正在尝试的是,将记录集对象中的特定值,我的示例代码

分开
$oUser = UserInfo::getByEmail($em);
            echo "<pre>";
            print_r($oUser);
            foreach($oUser as $key=>$value){
               echo $value['uNumLogin'];
            }

print_r的输出是

UserInfo Object
(
    [error] => 
    [uID] => 16
    [uLastLogin] => 1384932506
    [uLastIP] => 0
    [uIsValidated] => -1
    [uPreviousLogin] => 1384932463
    [uIsFullRecord] => 1
    [uNumLogins] => 0
    [uDateAdded] => 0000-00-00 00:00:00
    [uIsActive] => 1
    [uLastOnline] => 1384932508
    [uHasAvatar] => 0
    [uName] => empdhivya
    [uEmail] => shankumars@gmail.com
    [uPassword] => 3917b4028f23f1d33fea9af856f0bd8b
    [uTimezone] => 
)

但是我尝试了这段代码

foreach($oUser as $key=>$value){
                   echo $value['uNumLogin'];
                }

显示输出

110-1100110es3

请有人帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:0)

这将完美地用于记录集对象的单独值

foreach($oUser as $key=>$value){
   if($key=='uNumLogins')
    $val = $value;
}

这个答案就是我自己的要求,如果有任何错误请纠正我的错误。