这篇文章介绍的内容是关于PHP滚动抽奖代码,有着一定的参考价值,现在分享给大家,有需要的朋友可以参考一下
页面:
| |
|
js代码:
控制器:
public function tvshowAction(){ $prize = $this->_request->get('prize'); $this->view->prize=$prize; } public function getdataAction() { global $db; $ids = $db->fetchCol('SELECT id FROM oa_user_question WHERE id IN (SELECT min(id) FROM oa_user_question GROUP BY phone) and is_show=1; '); $questions = $db->fetchAll('select * from oa_user_question where is_show=1'); $arr=array(); foreach($questions as $question){ $question['realname']=mb_strlen($question['realname'])>8?(substr($question['realname'],0,8).'...'):$question['realname']; $question['realname']=iconv('gbk', 'utf-8', $question['realname']); foreach($ids as $id){ if($question['id']==$id){ $arr[$id]=$question; } } } $result=array( 'ids'=>$ids, 'question'=>$arr ); echo json_encode($result ); die; }
相关推荐:
Atas ialah kandungan terperinci PHP滚动抽奖代码. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!