Home > Backend Development > PHP Tutorial > 求问下这个 Call to undefined function int()的缘故

求问下这个 Call to undefined function int()的缘故

WBOY
Release: 2016-06-13 12:45:45
Original
1252 people have browsed it

求问下这个 Call to undefined function int()的原因
public static function getById($uid){
    $user = new User;
    $sql = sprintf('SELECT username, password, email_add, is_active, perm  FROM  %suser  WHERE user_id = %d',DB_TB_PREFIX, mysql_real_escape_string($uid));
    $query = mysql_query($sql);
    if(mysql_num_rows($query) && $res = mysql_fetch_assoc($query)){
        $user->uid = int($uid);//注意这里用了int
        $user->username = $res['username'];
        $user->password = $res['password'];
        $user->isActive = $res['is_active'];
        $user->emailAddr = $res['email_add'];
        $user->perm = $res['perm'];
    }

    return $user;
}

当我在另一个页面
$user = User::getById($_SESSION['uid']);//$_SESSION['uid']是存在的

报错 Call to undefined function int();

请问是什么原因?

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template