分页:
thinkphp5分页默认只带page参数
在使用form表单method='get'传递关键字来筛选;
保证每次刷新依旧带上筛选参数
但遇到分页时,下面的分页默认自带page,没有之前筛选的参数
解决方法
$param = array(urlencode('keyword')=>urlencode('value')); $data = $model->...->paginate(10,false,['query' => $parem])
注意二维数组时 我的方法是这样
$parem[urlencode('create_time[start]')]=urlencode($keyword['start']); $parem[urlencode('create_time[end]')]=urlencode($keyword['end'])
即可
手册部分:http://www.kancloud.cn/manual/thinkphp5/154294
excel:
根目录执行:composer require phpoffice/phpexcel
$objPHPExcel = new PHPExcel(); $objReader = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); $objPHPExcel = PHPExcel_IOFactory::load($path); $objPHPExcel->setActiveSheetIndex(0); $sheet = $objPHPExcel->getSheet(0); $highestRow = $sheet->getHighestRow(); // 取得总行数 $highestColumn = $sheet->getHighestColumn(); // 取得总列数 $arrExcel = $objPHPExcel->getSheet(0)->toArray(); $save_data = array(); for($i=2;$i<=$highestRow;$i++){ //从哪列开始,A表示第一列 $b_value= trim($objPHPExcel->getActiveSheet()->getCell("B".$i)->getValue()); $c_value = trim($objPHPExcel->getActiveSheet()->getCell("C".$i)->getValue()); $d_value = trim($objPHPExcel->getActiveSheet()->getCell("D".$i)->getValue()); }