-
- /**
- * @todo Optimize EXCEL table output for YII query output with database table field names and key names
- * @todo Replace key names with 0, 1, 2...
- * @param array $data
- * @return array( 'excel_title'=array(),'excel_ceils'=array());
- */
- public function excelDataFormat($data){
- for ($i=0;$i$ each_arr=$data[$i];
- $new_arr[]=array_values($each_arr); //Return all key values
- }
- $new_key[]=array_keys($data[0]); //Return all index values
- return array('excel_title'=>$new_key[0],'excel_ceils'=>$new_arr);
- }
Copy code
The author wrote this method purely to handle EXCEL export , if it is often used in the project, you can change the name!
|