多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
连贯操作total用于在查询数据的同时,返回合计行。比如要统计某一列的和、平均值等。 ### 自动列名称 ~~~ 代码: $m->headTotal(array('GrossWeight'=>'sum','TareWeight'=>'count','NetWeight'=>'avg'))->select(); 结果格式: array (size=38) 0 => array (size=3) 'GrossWeight' => string '894248.000' (length=10) 'TareWeight' => string '37' (length=2) 'NetWeight' => string '22375.6486486' (length=13) 1 => array (size=31) '字段1' => string '89826' (length=5) '字段2' => string '89826' (length=5) …… ~~~ ### 指定列名称 ~~~ 代码: $m->footTotal(array('GrossWeight'=>array('sum','a'),'TareWeight'=>array('count','b'),'NetWeight'=>array('avg','c')))->select(); 结果格式: array (size=38) 0 => array (size=31) '字段1' => string '89826' (length=5) '字段2' => string '89826' (length=5) …… 1 => array (size=3) 'a' => string '894248.000' (length=10) 'b' => string '37' (length=2) 'c' => string '22375.6486486' (length=13) ~~~