php 下载简历
下载简历:先生成html模版,然后在下载转化为word格式;
获取数据方法:
先获取数据,然后开启缓存,写入数据,关闭缓存;然后下载成word;
/**
* 下载简历--简单
* @author LaoWen <bjlaowen@163.com>
*/
public function downresume(){
$uid = 4; // $uid = $_GET['uid'];
// 获取用户基本信息
$data['userInfo'] = $model_UserInfo->where( 'UR_ID = '.$uid )->find();
// 获取工作经历信息
$data['userWork'] = $model_UserWorkInfo->where( 'UR_ID = '.$uid )->select();
// 获取教育经历信息
$data['userEdu'] = $model_UserEdu->where( 'UR_ID = '.$uid )->select();
// 获取期望工作信息
$data['userWant'] = $model_UserWork->where( 'UR_ID = '.$uid )->find();
// 获取项目经验信息
$data['userProject'] = $model_UserProject->where("UR_ID = ".$uid)->select();
// 赋值
$this->assign('data',$data);
// 写入缓存
ob_start();
$this->display();
$html = ob_get_contents();
ob_clean();
$name = $data['userInfo']['name'].'的简历';
header('Content-type: application/doc');
header('Content-Disposition: attachment; filename="'.$name.'.doc"');
echo $html;
}