几年前写过类似的垃圾教程,今天因为需求原因,重新写了下教程,其实就是简单的sql查询!
获取指定uid用户的信息
如下获取的就是uid等于1和2的用户信息
<?php
$id=array(1,2);
$db = Typecho_Db::get();
$userinfo=$db->fetchAll($db->select()->from ('table.users')->where ('table.users.uid in ?',$id));
print_r($userinfo);
?>
获取单独用户信息
如下获取的就是uid等于1的用户信息
<?php
$db = Typecho_Db::get();
$userinfo=$db->fetchRow($db->select()->from ('table.users')->where ('table.users.uid = ?','1'));
print_r($userinfo);
?>
获取所有用户的信息
<?php
$db = Typecho_Db::get();
$userinfo=$db->fetchAll($db->select()->from ('table.users'));
print_r($userinfo);
?>
mark~
收藏备用~