0
我正在尝试创建一个csv并将其下载到浏览器。从我能找到的东西来看,在Symfony2中几乎有这个ZERO文档。Symfony2创建并下载CSV
这里是我的代码:
// Pass in all of the variables that will make up the pdf...
$response = $this->renderView('WICPurchaseOrderBundle:PurchaseOrder:csv.html.twig', array("data"=>$data
)
);
$response->headers->set('Content-Type', 'text/csv'); // This is line 929 in the error.
$response->headers->set('Content-Disposition', 'attachment; filename="teams.csv"');
return $response;
这是错误我得到:
Notice: Trying to get property of non-object in /Applications/XAMPP/xamppfiles/htdocs/symfonydev/src/WIC/PurchaseOrderBundle/Controller/PurchaseOrderController.php line 929
任何有CSV在Symfony2中的经验,并能帮助我吗?谢谢!
哇,我不能相信这是这么简单。非常感谢你的帮助! – LargeTuna