Example of exporting PHP data to excel file format
- $db = M('dazhuanpan_log');
- if($user['ismain'] != 1 && $user['uid'] != '')
- $condition[' uid'] = $user['uid'];
- $id = $this->_get('iid');
- $condition['oid'] = $id;
- $condition['prize'] = array ("neq","null");
- $condition['openid'] = array("neq","");
-
- $list = $db->where($condition)->select() ;
-
- $info = M("dazhuanpan")->where("id=$id")->find();
- $xlsName = $info['topic'] . "Winning statistics" . date( "YmdHis",time());
- $xlsCell = array(
- array('id','number'),
- array('openid','WeChat OPENID'),
- array('prize','Winning content '),
- array('tel','phone'),
- );
- //The header of the exported file name gets the data from the database. Note that it corresponds to the header.
- $this->exportExcel($xlsName,$xlsCell,$list);//This way you can export the excel file.
- ?>
Copy code
|