php数组取模

public function indexRecomHouse($area){
            $where = array();
            $where['a.isDel'] = '0';
            $where['a.status'] = '2';
            $where['a.auditstatus'] = '1';//已审核
            $where['a.salestatus'] = '0';//在售
            $where['a.isRecom'] = 'Y';
            $order = "a.verifyTime desc";
            $field = "a.esfId,c.shi,c.ting,c.chu,c.wei,a.price,a.buildingArea,b.fangAreaId,a.villageId,b.villageName";
            $data = $this->table($this->tablePrefix."house as a")->join("left join ".$this->tablePrefix."village as b on a.villageId=b.villageId")->join("left join ".$this->tablePrefix."village_pic_hsize as c on a.hsizeId=c.picId")->where($where)->field($field)->order($order)->limit(15)->select();
            if($data){
            $areaDb = D("FangArea");
            $housePicDb = D("HousePic");
            $num=0;
            foreach($data as $key => $val){
            $data[$key]['detailUrl'] = "http://esf.$area.qq.com/House1/detail?esfId=".$val['esfId'];
            $data[$key]['thumbUrl'] = $housePicDb->getThumb($val['esfId']);
            $data[$key]['areaName'] = $areaDb->getName($val['fangAreaId']);
            $data[$key]['zuhe'] = $val['shi']."室".($val['ting'] ? $val['ting']."厅" : "").($val['wei'] ? $val['wei']."卫" : "");
            $a=  explode('.', $val['buildingArea']);
                                if($a[1]>0){
                                $data[$key]['buildingArea'] =  $a[0].'.'.$a[1];   
                                }else {
                                $data[$key]['buildingArea'] =  $a[0];       
                                }
                                $b=  explode('.', $val['price']);
                                if($b[1]>0){
                                $data[$key]['price'] =  $b[0].'.'.$b[1];   
                                }else {
                                $data[$key]['price'] =  $b[0];       
                                }
                                //处理3层数据结构,每组下面5条数据
                                if($key%5 !=0){
                                $arr[$num][]=$data[$key];
                            }else {
                                $arr[$num+1][]=$data[$key];
                                $num +=1;
                            }
                       }
                        
                                            }
                                            return $arr;
                                        }

网页题目:php数组取模
本文来源:http://bzwzjz.com/article/jespcp.html

其他资讯

Copyright © 2007-2020 广东宝晨空调科技有限公司 All Rights Reserved 粤ICP备2022107769号
友情链接: 成都网站制作 定制网站建设多少钱 专业网站设计 网站设计制作 营销型网站建设 成都网站建设公司 成都响应式网站建设 手机网站制作设计 成都企业网站建设 成都网站制作 成都网站制作 成都网站制作 成都网站建设 网站制作报价 外贸营销网站建设 攀枝花网站设计 定制网站设计 成都网站制作 成都h5网站建设 成都网站制作公司 企业网站建设公司 专业网站设计