脚本宝典收集整理的这篇文章主要介绍了php – Symfony 2 kpn snappy生成pdf,输出符合安全区域,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
$pageUrl = $this->generateUrl('accounts_management_generate_pdf_markup',array('invoice' => $invoiceData),true); // use absolute path! return new \Symfony\component\HttpFoundation\Response( $this->get('knp_snappy.pdf')->getOutput($pageUrl),200,array( 'Content-tyPE' => 'application/pdf','Content-DisposITion' => 'attachment; filename="file.pdf"' ) );
问题是pageUrl accounts_management_generate_pdf_markup位于安全区域后面,未经身份验证就无法访问.生成的文件只是登录页面,如果未记录,此路径account_management_generate_pdf_markup将重定向到该登录页面.
我的问题是:
$pageUrl = $this->generateUrl('route',array('id' => $id),true); $session = $this->get('session'); $session->save(); session_write_close(); return new Response( $this->get('knp_snappy.pdf')->getOutput($pageUrl,array('cookie' => array($session->getName() => $session->getId()))),array( 'Content-Type' => 'application/pdf','Content-Disposition' => 'attachment; filename="file.pdf"' ) );
以上是脚本宝典为你收集整理的php – Symfony 2 kpn snappy生成pdf,输出符合安全区域全部内容,希望文章能够帮你解决php – Symfony 2 kpn snappy生成pdf,输出符合安全区域所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。