Home >php教程 >php手册 >将内容放到word文档

将内容放到word文档

WBOY
WBOYOriginal
2016-06-07 11:35:581210browse

转存数据
//简历下载方法<br>     public function actionDlresume(){<br>         <br>         //数据查询<br>             $id = I("get.id");<br>                         $where['company_id'] = $id;<br>             $re = M("company")->where($where)->select();<br>             // print_r($re);die;<br>             $html ='<table> <br>     <tr> <br>       <td> 姓名</td> <br>       <td>  '.$re['u_name'].'</td> <br>       <td>性别</td> <br>       <td>'.$re['g_sex'].'</td> <br>       <td>学历</td> <br>       <td>'.$re['school_type'].'</td> <br>     </tr> <br>     <tr> <br>       <td>工作时间</td> <br>       <td>'.$re['work_year'].'</td> <br>       <td>毕业<br>学校</td> <br>       <td>'.$re['g_school'].'</td> <br>       <td>所在<br>城市</td> <br>       <td>'.$re['city_name'].'</td> <br>     </tr> <br>     <tr> <br>       <td>联系邮箱</td> <br>       <td>'.$re['work_email'].'</td> <br>       <td>联系<br>电话</td> <br>       <td>'.$re['work_phone'].'</td> <br>       <td>当前<br>状态</td> <br>       <td>'.$re['work_type'].'</td> <br>     </tr> <br>     <tr> <br>       <td> <br><br>教育<br>背景<br><br> </td> <br>       <td>'.$re['edutation'].'</td>     <br>     </tr> <br>     <tr> <br>       <td> <br><br>工作<br>经历<br><br> </td> <br>       <td>'.$re['g_workj'].'</td>     <br>     </tr> <br>     <tr> <br>       <td> <br><br><br>作品<br>展示<br><br><br><br> </td> <br>       <td>'.$re['g_zuo'].'</td> <br>     </tr> <br>     </table> <br><br><br><br><br> ';<br>  <br>  // print_r($html);die;<br>      // $word->start();<br>      <br>      ob_start();<br> <br>         echo "         xmlns:w='urn:schemas-microsoft-com:office:word'
        xmlns='http://www.w3.org/TR/REC-html40'>";
     
     echo $html;
     echo "";
      // $word->save($filename);
      $data = ob_get_contents();
      // print_r($data);die;
      // die;
        ob_end_clean();
        $filename = $re['u_name'].'.doc';
        $fp=fopen($filename,"wb");
        fwrite($fp,$data);
        fclose($fp);

      //文件的类型
      header('Content-type: application/word');
      header("Content-Disposition: attachment; filename=".$filename);
      readfile($filename);
      ob_flush();
      flush();
     exit();
    
    }

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn