我正在使用this库。所以当我下载
时出现此错误未定义的变量:cv_info
这是我的控制器
public function downloadPDF()
{
$url=Input::get('url');
$url=explode('/', $url);
$cv_id = substr($url[4], 0, -13);
$name=Auth::user()->username;
$cv_info=CV::where('id','=',$cv_id)->first();
$html = view('ui.userinfo.viewCV',$cv_info)->render();
return $this->pdf
->load($html)
->show();
}
我已经通过了$ cv_info来查看为什么我有这个错误。谢谢你的帮助
$ html = view(' ui.userinfo.viewCV',$ cv_info) - > render();
答案 0 :(得分:0)
你没有正确传递它。
$html = view('ui.userinfo.viewCV')->with('cv_info', $cv_info);
或者你可以使用
$html = view('ui.userinfo.viewCV', ['cv_info' => $cv_info])->render();