我想出了如何单独解决这个问题。
显示用户属性:
<?php
//Create a User object (of the current User)
$u = new User();
//Creat a UserInfo object with the user ID
$ui = UserInfo::getByID($u->getUserID());
//Get the Value of your user Attribute
$value = $ui->getAttribute('name');
//Print it out
echo $value;
?>显示页面所有者:
<?php
$ownerID = $cobj->getCollectionUserID();
$uia = UserInfo::getByID($ownerID);
$ownerName = $uia->getUserName();
echo $ownerName
?> 但是我不知道如何将它们放在一起,所以它会显示页面所有者的属性(‘name’);
你们能帮帮忙吗
谢谢
发布于 2012-08-25 00:31:26
在对代码进行了更多的修改之后。我想我只需要把
$cobj->getCollectionUserID();转到
$ui = UserInfo::getByID($u->getUserID()); 所以最终的代码是:
<?php
//Creat a UserInfo object with the Owner
$ui = UserInfo::getByID($cobj->getCollectionUserID() );
//Get the Value of your user Attribute
$value = $ui->getAttribute('name');
//Print it out
echo $value;
?>https://stackoverflow.com/questions/12113182
复制相似问题