标签:
1 .先把mpdf-development.zip解压的类文件夹放到vendor目录里面,重命名为mpdf 2 .在vendor/composer/autoload_namespaces.php里面添加 ‘mPDF‘ => array($vendorDir . ‘/mpdf‘),(看看是几层目录) //控制器里,方法 use mPDF; //下载pdf简历 public function actionLoadpdf() { //这里写你在preview试图层遍历的数据(必须写) //一下是简历页面的查询数据 $session = Yii::$app->session; $u_id=$session->get(‘u_id‘); $user= new User(); $person=$user->find()->select(" user,sex,degree,email,phone,status,projectdesc,company, zhi,expection,selfdesc,project,school,professional,city,position, salary,workyear,addtime") ->where([‘u_id‘=>$u_id])->orderBy(‘addtime desc‘)->limit(1)->asArray()->one(); $region=new Region(); $ros=$region->getinfo(); //实例化中文 $mpdf=new mPDF(‘zh-CN‘); $mpdf->useAdobeCJK = true; //原来的html页面 $mpdf->WriteHTML($this->renderPartial("jianli",array(‘region‘=>$ros,‘person‘=>$person))); //保存名称 $mpdf->Output(‘MyPDF.pdf‘, ‘D‘); exit; } 3 .视图层超链接跳转到控制器的方法
标签:
原文地址:http://www.cnblogs.com/jhy-ocean/p/5364947.html