php 随机取相关数据

public function gethots($label,$minhotid,$maxhotid,$count=60,$offet=0){
        $db = $this->_db;
        $select = $db->select();
        $select->from(DB_PREFIX."word_hot");
        $random = rand($minhotid,$maxhotid);
        // var_dump($random);
        $select->where("name like '%$label%' and id >= $random");        
        //$select->order("id desc");
        $select->limit($count,$offet);
        //echo $select->__toString();die;
        $result = $db->query($select);
        $rows = $result->fetchAll();
        return $rows;
    }

posted @ 2021-06-30 15:05  萌妹子的vlog  阅读(79)  评论(0)    收藏  举报