JasperPHP.php 第 178 行异常:您的报告有错误,无法处理

Exception in JasperPHP.php line 178: Your report has an error and couldn't be processed

如果你有时间重播给我。 我尝试在 Laravel 5 中使用 JasperPHP 但不能。我用静态文本制作样本报告: 但是当我发布它并从 Laravel 开始时使用该代码:

    $output = public_path() . '/report/Test';
    $ext = "pdf";
    $jasper = JasperPHP::compile(
        public_path() . '/reports/Test.jasper',
        true
    )->execute();

    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename='.time().'Test.'.$ext);
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    header('Pragma: public');
    header('Content-Length: ' . filesize($output.'.'.$ext));
    flush();
    readfile($output.'.'.$ext);
    unlink($output.'.'.$ext); // deletes the temporary file

而 Laravel 给我一个错误:

第 178 行 JasperPHP.php 异常:您的报告有错误,无法处理!尝试使用函数 output(); 和 运行 在控制台中手动输出命令。

你能帮帮我吗?我做错了什么?我想为该报告生成 pdf 文件并将其发送给客户。

还有一个问题。如何发送参数到报告?

我在尝试使用带有数据集的真实报告时遇到同样的问题

当我将其更改为:

   $jasper = new JasperPHP;
    $jasper->process(
        public_path() . '/reports/Faktura.jasper',
        $output,
        array("pdf"),
        array("fID"=>$request->fID),
        Config::get('database.connections.mysql')
    )->output();

fID 参数在哪里。在报告 Faktura 中也出现错误: 您的报告有错误,无法处理!尝试使用函数 output(); 和 运行 在控制台中手动输出命令。

当尝试输出时,我在输出中得到了:

TNX.

问题是我没有安装 JasperStarter。之后需要设置 MYSQL 连接器。有关更多信息,请查看: