标签:
1 <?php 2 public function export_do_one(){ //excel 导出数据 3 import(‘ORG.Util.Page_new‘);// 导入分页类 ,修改了原来的Page分页类 4 $order_sms_reply=M(‘order_sms_reply‘); 5 $order_sms=M(‘order_sms‘); 6 $data=null; 7 $data[‘A.content‘]=1; 8 $data[‘B.type‘]=‘xiaofeizhe_pingjia‘; 9 $total_count = M(‘order_sms_reply‘)->alias("A")->join(‘z_order_sms as B on A.mobi=B.mobi‘)->where($data)->count();// 查询满足要求的总记录数 10 $Page = new Page($total_count,20);// 实例化分页类 传入总记录数和每页显示的记录数 11 //$show = $Page->show();// 分页显示输出 12 //$rs=M(‘order_sms_reply‘)->alias("A")->join(‘z_order_sms as B on A.mobi=B.mobi‘)->where($data)->limit($Page->firstRow.‘,‘.$Page->listRows)->field(‘A.mobi,A.content,B.remark‘)->select(); 13 $this->assign(‘page‘,$show);// 赋值分页输出 14 $totalPages=$Page->totalPages; //得到总的页面数量 15 for($i=1;$i<=10;$i++){ 16 $page_start=$i*20-20; 17 $rs=M(‘order_sms_reply‘)->alias("A")->join(‘z_order_sms as B on A.mobi=B.mobi‘)->where($data)->limit($page_start,20)->field(‘A.mobi,A.content,B.remark‘)->select(); 18 $rs_total[]=$rs; 19 } 20 if($rs_total){ 21 return $rs_total; 22 } 23 } 24 25 public function export_one(){ 26 $order_list=$this->export_do_one(); 27 foreach($order_list as $k=>$v){ 28 foreach($v as $k2=>$v2){ 29 $v3[]=$v2; 30 } 31 } 32 //dump($v3);die; 33 $v3=array(); 34 //phpinfo();die; 35 // foreach($v3 as $k3=>$v3){ 36 // $v4[]=$v3; 37 // } 38 // $strlen_arr=count($v4); 39 // for($j=0;$j<=$strlen_arr;$j++){ 40 // 41 // } 42 R("Excel/excel_export", 43 array( 44 $v3, //数组 45 ‘消费者回复1的‘, 46 ‘消费者回复2的‘ 47 ) 48 ); 49 } 50 ?>
标签:
原文地址:http://www.cnblogs.com/719907411hl/p/4505542.html