在laravel中调用null错误的成员函数download()

时间:2016-03-16 17:56:45

标签: php pdf laravel-5 laravel-5.1

我正在尝试在浏览器中下载PDF但我收到此错误

Call to a member function download () on null

这是代码:

public function index(){
  $data ="<h1>Welcome</h1>";
  $content= PDF::loadView('PDF.invoice', $data);
 return $content->download('invoice.PDF');
}

我尝试了save('invoice.PDF')Output('invoice.PDF')而不是download('invoice.PDF'),但它一直显示member function download () on null。任何人都可以解决这个问题吗?

0 个答案:

没有答案