求问下这个 Call to undefined function int()的缘故
程序员文章站
2022-04-28 14:54:06
...
求问下这个 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();
请问是什么原因?
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();
请问是什么原因?
专题推荐
-
独孤九贱-php全栈开发教程
全栈 170W+
主讲:Peter-Zhu 轻松幽默、简短易学,非常适合PHP学习入门
-
玉女心经-web前端开发教程
入门 80W+
主讲:灭绝师太 由浅入深、明快简洁,非常适合前端学习入门
-
天龙八部-实战开发教程
实战 120W+
主讲:西门大官人 思路清晰、严谨规范,适合有一定web编程基础学习
- 最新文章
- 热门排行
网友评论
文明上网理性发言,请遵守 新闻评论服务协议
我要评论