我在 KnpSnappy Bundle 文档中遗漏了一些内容。:( 如何使用 Symfony 和 KnpSnappy 将我的 pdf 保存到服务器。我不希望我的 pdf 下载到浏览器。我希望它保存到服务器。请帮忙!非常感谢。
 Server Path: $pdfFolder = $_SERVER['DOCUMENT_ROOT'].'/symfonydev/app/Resources/account_assets/'.$account_id.'/pdf/'; 
 return new Response(
        $this->get('knp_snappy.pdf')->getOutputFromHtml($content),
        200,
        array(
            'Content-Type'          => 'application/pdf',
            'Content-Disposition'   => 'attachment; filename="'.$pdfFolder.''.strtotime('now').'.pdf"'
        )
    );
正如您从文档中看到的,您需要使用另一个函数:
$this->get('knp_snappy.pdf')->generateFromHtml($content, $pdfFolder . time() . '.pdf';
正如你所看到的,我将你的替换strtotime('now')为time(). 会更快。