thinkphp5 sql函数

count用法  

字段写在count里面

Db::table('ys_users_parent')->count('distinct parent');

条件搜索加where

 Db::table('pay_order')->where('pay_time>0')->count();

$kaishi = strtotime('1 minute',strtotime($input_data['start_time'])); 

 $jieshu = strtotime('1 day',strtotime($input_data['end_time'])); 

  $login_count = Db::table('user_logs')->where('time', 'between', [$kaishi, $jieshu])->count();

你可能感兴趣的:(php)