当前位置:Gxlcms > 数据库问题 > TP随机从数据库中获取一条数据

TP随机从数据库中获取一条数据

时间:2021-07-01 10:21:17 帮助过:4人阅读

* * 随机获取一条商品信息 * @param [type] $condition * @param [type] $field * @param [type] $limit * @return void */ public function randSkuid($condition, $field, $limit) { $result = $this->where($condition)->field($field)->orderRaw(‘rand()‘)->limit($limit)->select(); return $result ? $result->toArray() : []; }

 

TP随机从数据库中获取一条数据

标签:mit   span   HERE   raw   type   code   err   void   limit   

人气教程排行