- case sentence_info: // 每日一句列表
- $pageIndex=($_POST[pageIndex]-1)*$_POST[displayNumber];
- $displayNumber=$_POST[displayNumber];
- // $month=$_POST[month];
- $result_num = mysql_query("select sid from i_sentence");
- $total = mysql_num_rows($result_num);
- $total_page=ceil($total/$displayNumber);
- $arr=array();
- $query=mysql_query("select sid,picture,picture2,content,note,browsenum,translation,tts,dateline from i_sentence where 1=1 order by dateline desc limit $pageIndex,$displayNumber");
- while($row=mysql_fetch_assoc($query))
- {
- $row[note]=urlencode(preg_replace("/(\\s|\\ \\;||\\xc2\\xa0)/","",$row[note]));
- $row[translation]=urlencode(preg_replace("/(\\s|\\ \\;||\\xc2\\xa0)/","",$row[translation]));
- // $row[imgs]=get_img($row[id]);
- $row[dateline]=urlencode(date('Y M d',strtotime($row[dateline])));
- $picinto=pathinfo($row[picture2]);
- if(!empty($picinto[extension]))
- {
- $row[picture]=$row[picture2];
- }
- unset($row[picture2]);
- $arr[]=$row;
- }
- $data=urldecode(json_encode($arr));
- $s=mysql_errno();
- //echo $data;
- echo "{\\"s\\":$s,\\"data\\":$data,\\"total\\":$total_page}";
- break;
- //该片段来自于http://www.codesnippet.cn/detail/0408201410093.html
来源: http://www.codesnippet.cn/detail/0408201410093.html