Rumah >pembangunan bahagian belakang >tutorial php > 求问下这个 Call to undefined function int()的缘故
求问下这个 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();
请问是什么原因?