21,886
社区成员
发帖
与我相关
我的任务
分享
class user
{
public function GetUserInfo($user)
{
$return = array();
$this->rDbConn->mSql = "select * from USER where uid = '" . addslashes($user) . "'";
$this->rDbConn->CreateConn();
$this->rDbConn->GetResult();
if ($this->rDbConn->GetRowNum()>0)
{
if ($this->rDbConn->GetRow())
{
$return = $this->rDbConn->mRow;
}
}
$this->rDbConn->Close();
return $return;
}
}
调用的时候如下:
$class_user = new User($db);
$userInfo = $class_user->GetUserInfo($user);
user类中GetUserInfo的定义
public function GetUserInfo($user)
{
$return = array();
$this->rDbConn->mSql = "select * from USER where uid = '" . addslashes($user) . "'";
$this->rDbConn->CreateConn();
$this->rDbConn->GetResult();
if ($this->rDbConn->GetRowNum()>0)
{
if ($this->rDbConn->GetRow())
{
$return = $this->rDbConn->mRow;
}
}
$this->rDbConn->Close();
return $return;
}
下面是调用
$class_user = new User($db);
$userInfo = $class_user->GetUserInfo($_SESSION['loginfo']['userid']);
$smarty->assign('regdate',$userInfo['reg_date']);
最后一行就出错提示
Catchable fatal error: Object of class stdClass could not be converted to string
但在服务器上就显示正常,楼上的方法也试过了,还是一样的问题.