TP如何进行批量查询

  1. public function getUserInfo($uid){
  2.     if(is_null($uid) || empty($uid)){return false;}
  3.     if(is_array($uid)){
  4.         $where['user_id'] = array('in',$uid);
  5.     }else{
  6.         $where['user_id'] = array('eq',$_SESSION['uid']);
  7.     }
  8.     return M('User')->where($where)->select();
  9. }

最近在优化代码,特别实用。

posted @ 2017-10-30 16:46  刘俊涛的博客  阅读(652)  评论(0编辑  收藏  举报