thinkphp5

分頁:php

thinkphp5分頁默認只帶page參數thinkphp

在使用form表單method='get'傳遞關鍵字來篩選;數組

保證每次刷新依舊帶上篩選參數composer

但遇到分頁時,下面的分頁默認自帶page,沒有以前篩選的參數thinkphp5

解決方法ui

$param = array(urlencode('keyword')=>urlencode('value'));
$data = $model->...->paginate(10,false,['query' =>  $parem])

注意二維數組時 個人方法是這樣url

$parem[urlencode('create_time[start]')]=urlencode($keyword['start']);
$parem[urlencode('create_time[end]')]=urlencode($keyword['end'])

便可spa

 

手冊部分:http://www.kancloud.cn/manual/thinkphp5/154294excel

 

excel:code

根目錄執行: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());
}
相關文章
相關標籤/搜索