将 PDF 存储在 MySQL 数据库中

Bic*_*icu 2 php pdf symfony twig

我正在开发一个应用程序,我需要创建 PDF 格式的发票。我正在使用pdfbundle并且 PDF 文件已正确创建:

public function helloAction()
{
    $format = $this->get('request')->get('_format');
    $name = "work!!!";
    return $this->render(sprintf('miomioBundle:Venta:helloAction.%s.twig', $format), array('name' => $name));
}
Run Code Online (Sandbox Code Playgroud)

但我怎样才能将该文件存储在数据库中呢?

nic*_*har 5

您最好将它们作为文件存储在磁盘上并引用它们在数据库中的位置。所以存储:

/路径/到/商店/invoice_434992.pdf

在相关表中,每个表都有一个唯一的文件名,并在需要时引用它。